Skip to content

Commit

Permalink
Tests: isolate to different directories
Browse files Browse the repository at this point in the history
  • Loading branch information
ace-n-msft committed Dec 27, 2024
1 parent eea511a commit cefaf35
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
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

0 comments on commit cefaf35

Please sign in to comment.