Skip to content

Commit

Permalink
fix test setup; disable test temporarily; …
Browse files Browse the repository at this point in the history
* run unit tests in separate environment
* show unstaged changed files
  • Loading branch information
zawys committed Feb 6, 2021
1 parent 2c79266 commit a301ecd
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@
"bundle": "parcel build --target main --no-cache --detailed-report 10 ${npm_package_source}",
"build:dev": "yarn run bundle:dev",
"build": "yarn install && yarn run clean && yarn run bundle && yarn run package",
"working_dir_is_clean": "git diff --quiet && ! git ls-files -o --exclude-standard | grep -q '.'",
"index_is_clean": "git diff --staged --quiet && git diff --quiet && ! git ls-files -o --exclude-standard | grep -q '.'",
"working_dir_is_clean": "git diff --quiet && ! git ls-files -o --exclude-standard | grep '.'",
"index_is_clean": "git diff --staged --quiet && git diff --quiet && ! git ls-files -o --exclude-standard | grep '.'",
"format": "prettier --ignore-path .gitignore --write .",
"pre-commit": "ts-node ./tools/pre-commit.ts",
"post-commit": "ts-node ./tools/post-commit.ts",
Expand Down
6 changes: 4 additions & 2 deletions test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as unitTests from "./unitTest.systemTest";
import * as unstashConflictTests from "./unstashConflict.systemTest";
// TODO [2021-03-01] Disable the test which requires
// stable Code to be installed because of a packaging bug with Code.
// import * as unstashConflictTests from "./unstashConflict.systemTest";

export async function runTests(): Promise<boolean> {
return (await unitTests.runTest()) || (await unstashConflictTests.runTest());
return await unitTests.runTest() /*|| (await unstashConflictTests.runTest())*/;
}
1 change: 1 addition & 0 deletions test/suite/unitTest.systemTest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/environment/
Binary file added test/suite/unitTest.systemTest/environment.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion test/suite/unitTest.systemTest/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runSystemTest } from "../../systemTest";

export async function runTest(): Promise<boolean> {
return await runSystemTest(__dirname, true);
return await runSystemTest(__dirname);
}
1 change: 1 addition & 0 deletions test/suite/unstashConflict.systemTest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/environment/
Binary file modified test/suite/unstashConflict.systemTest/environment.zip
Binary file not shown.
14 changes: 11 additions & 3 deletions test/systemTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { whichPromise } from "../src/getPaths";
*/
export async function runSystemTest(
testDirectory: string,
noWorkspace = false
dirtyEnvironment = false
): Promise<boolean> {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`.
Expand All @@ -21,10 +21,18 @@ export async function runSystemTest(
const extensionTestsPath = path.resolve(testDirectory, "./suite/index");

const launchArguments = ["--new-window", "--disable-extensions"];
if (!noWorkspace) {
if (!dirtyEnvironment) {
const zipPath = path.resolve(testDirectory, "environment.zip");
const filesPath = await unpackToTemporaryDirectory(zipPath);
launchArguments.push(path.resolve(filesPath, "workspace"));
const environmentPath = path.resolve(filesPath, "environment");
const workspaceDirectory = path.resolve(environmentPath, "workspace");
const userDataDirectory = path.resolve(environmentPath, "user_data_dir");
if (fs.existsSync(userDataDirectory)) {
launchArguments.push(`--user-data-dir=${userDataDirectory}`);
}
if (fs.existsSync(workspaceDirectory)) {
launchArguments.push(workspaceDirectory);
}
}
const debugTestFilePath = process.env["DEBUG_CURRENT_FILE_PATH"];
let debugging = false;
Expand Down

0 comments on commit a301ecd

Please sign in to comment.