Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from microsoft:main #47

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
"build": "tsc",
"pbiviz": "node ./bin/pbiviz.js",
"start": "npm run pbiviz start",
"test": "npm run build && npm run clean-tests && npm run lint && npm run jasmine",
"test": "npm run build && npm run lint && npm run jasmine",
"jasmine": "node spec/jasmine-runner.js",
"jasmine-inspect": "node --inspect spec/jasmine-runner.js",
"lint": "npx eslint .",
"clean-tests": "node spec/clean-tests.js",
"debug-tests": "npm run clean-tests && npm run lint && npm run jasmine-inspect"
"debug-tests": "npm run lint && npm run jasmine-inspect"
},
"bin": {
"pbiviz": "./bin/pbiviz.js"
Expand Down
31 changes: 0 additions & 31 deletions spec/clean-tests.js

This file was deleted.

6 changes: 3 additions & 3 deletions spec/e2e/pbivizInfoSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import path from 'path';
import FileSystem from '../helpers/FileSystem.js';
import { writeMetadata } from "./testUtils.js";

const tempPath = FileSystem.getTempPath();
const tempPath = path.join(FileSystem.getTempPath(), path.basename(import.meta.url));
const startPath = process.cwd();

describe("E2E - pbiviz info", () => {
Expand All @@ -41,7 +41,7 @@ describe("E2E - pbiviz info", () => {

beforeEach(() => {
process.chdir(startPath);
FileSystem.resetTempDirectory();
FileSystem.resetDirectory(tempPath);
process.chdir(tempPath);
FileSystem.runPbiviz('new', visualName);
process.chdir(visualPath);
Expand All @@ -51,7 +51,7 @@ describe("E2E - pbiviz info", () => {

afterAll(() => {
process.chdir(startPath);
FileSystem.deleteTempDirectory();
FileSystem.deleteDirectory(tempPath);
});

it("Should throw error if not in the visual root", () => {
Expand Down
6 changes: 3 additions & 3 deletions spec/e2e/pbivizNewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { writeMetadata, readdirSyncRecursive } from "./testUtils.js";
import { download, createFolder, readJsonFromRoot } from "../../lib/utils.js";

const config = readJsonFromRoot('config.json');
const tempPath = FileSystem.getTempPath();
const tempPath = path.join(FileSystem.getTempPath(), path.basename(import.meta.url));
const templatePath = FileSystem.getTemplatePath();
const startPath = process.cwd();
const visualName = 'visualName';
Expand All @@ -43,7 +43,7 @@ const visualPath = path.join(tempPath, visualName);
describe("E2E - pbiviz new", () => {

beforeEach(() => {
FileSystem.resetTempDirectory();
FileSystem.resetDirectory(tempPath);
process.chdir(tempPath);
});

Expand All @@ -52,7 +52,7 @@ describe("E2E - pbiviz new", () => {
});

afterAll(() => {
FileSystem.deleteTempDirectory();
FileSystem.deleteDirectory(tempPath);
});

it("Should generate new visual with default template", () => {
Expand Down
6 changes: 3 additions & 3 deletions spec/e2e/pbivizPackageSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import lodashIsEqual from 'lodash.isequal';
import FileSystem from '../helpers/FileSystem.js';
import { writeMetadata } from "./testUtils.js";

const tempPath = FileSystem.getTempPath();
const tempPath = path.join(FileSystem.getTempPath(), path.basename(import.meta.url));
const startPath = process.cwd();

describe("E2E - pbiviz package", () => {
Expand All @@ -46,7 +46,7 @@ describe("E2E - pbiviz package", () => {

beforeEach(() => {
process.chdir(startPath);
FileSystem.resetTempDirectory();
FileSystem.resetDirectory(tempPath);
process.chdir(tempPath);
FileSystem.runPbiviz('new', visualName);
process.chdir(visualPath);
Expand All @@ -59,7 +59,7 @@ describe("E2E - pbiviz package", () => {

afterAll(() => {
process.chdir(startPath);
FileSystem.deleteTempDirectory();
FileSystem.deleteDirectory(tempPath);
});

it("Should throw error if not in the visual root", () => {
Expand Down
6 changes: 3 additions & 3 deletions spec/e2e/pbivizStartSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import FileSystem from '../helpers/FileSystem.js';
import { writeMetadata } from "./testUtils.js";
import { download, createFolder } from "../../lib/utils.js";

const tempPath = FileSystem.getTempPath();
const tempPath = path.join(FileSystem.getTempPath(), path.basename(import.meta.url));
const startPath = process.cwd();

// these tests can take a bit longer
Expand Down Expand Up @@ -63,7 +63,7 @@ describe("E2E - pbiviz start", () => {
const assetFiles = ['visual.js', 'visual.css', 'pbiviz.json', 'status'];

beforeEach(() => {
FileSystem.resetTempDirectory();
FileSystem.resetDirectory(tempPath);
process.chdir(tempPath);
FileSystem.runPbiviz('new', visualName, '--force');
FileSystem.runCMDCommand('npm i', visualPath, tempPath);
Expand All @@ -77,7 +77,7 @@ describe("E2E - pbiviz start", () => {

afterAll(() => {
process.chdir(startPath);
FileSystem.deleteTempDirectory();
FileSystem.deleteDirectory(tempPath);
});

xit("Should throw error if not in the visual root", () => {
Expand Down
6 changes: 3 additions & 3 deletions spec/e2e/pbivizWebpackVerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import semver from 'semver';
import FileSystem from '../helpers/FileSystem.js';
import { writeMetadata } from "./testUtils.js";

const tempPath = FileSystem.getTempPath();
const tempPath = path.join(FileSystem.getTempPath(), path.basename(import.meta.url));
const startPath = process.cwd();
const visualName = 'visualname';
const visualPath = path.join(tempPath, visualName);

describe("E2E - webpack tools", () => {
beforeEach(() => {
FileSystem.resetTempDirectory();
FileSystem.resetDirectory(tempPath);
process.chdir(tempPath);
FileSystem.runPbiviz('new', visualName, ' -t default --force');
process.chdir(visualPath);
Expand All @@ -53,7 +53,7 @@ describe("E2E - webpack tools", () => {

afterAll(() => {
process.chdir(startPath);
FileSystem.deleteTempDirectory();
FileSystem.deleteDirectory(tempPath);
});

const removeApi = () => {
Expand Down
14 changes: 7 additions & 7 deletions spec/helpers/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ export default class FileSystem {
}

/**
* Creates the temp directory (deletes it first if it exists)
* Creates a directory (deletes it first if it exists)
*/
static resetTempDirectory() {
FileSystem.deleteTempDirectory();
fs.ensureDirSync(TEMP_DIR);
static resetDirectory(directory) {
FileSystem.deleteDirectory(directory);
fs.ensureDirSync(directory);
}

/**
* Deletes the temporary directory if it exists
* Deletes a directory if it exists
*/
static deleteTempDirectory() {
static deleteDirectory(directory) {
try {
fs.removeSync(TEMP_DIR);
fs.removeSync(directory);
} catch (e) {
console.log('DELETE ERROR', e);
}
Expand Down