Skip to content

Commit

Permalink
feat(jest): tests working client side too
Browse files Browse the repository at this point in the history
  • Loading branch information
alacambre-yseop committed Apr 10, 2020
1 parent 5c7fc66 commit 48c1a47
Show file tree
Hide file tree
Showing 9 changed files with 1,945 additions and 389 deletions.
7 changes: 0 additions & 7 deletions client/jest.config.js

This file was deleted.

1,813 changes: 1,725 additions & 88 deletions client/package-lock.json

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@
"vscode": "^1.34.0"
},
"scripts": {
"test": "jest"
"test": "node ./out/test/runTests.js",
"test:update": "cross-env JEST_TEST_RUNNER_UPDATE_SNAPSHOTS=true npm test"
},
"dependencies": {
"event-stream": "3.3.4",
"typescript": "^3.5.2",
"vscode-languageclient": "^5.3.0-next.5"
},
"devDependencies": {
"@types/jest": "^24.9.1",
"@types/glob": "^7.1.1",
"@types/jest": "^24.9.1",
"@types/jest-cli": "^23.6.0",
"@types/node": "^12.0.12",
"@types/vscode": "^1.34.0",
"cross-env": "^7.0.2",
"glob": "^7.1.4",
"jest": "^24.9.0",
"jest-cli": "^24.9.0",
"vscode-jest-test-runner": "^1.0.0",
"vscode-test": "^1.2.3"
}
}
3 changes: 0 additions & 3 deletions client/src/test/declaration.d.ts

This file was deleted.

19 changes: 0 additions & 19 deletions client/src/test/index.ts

This file was deleted.

26 changes: 26 additions & 0 deletions client/src/test/runTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as path from 'path';
import { runTests } from 'vscode-test';

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../../');

// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, '../../node_modules/vscode-jest-test-runner');

// Download VS Code, unzip it and run the integration test
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: ['--disable-extensions'],
});
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
}

main();
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
moduleFileExtensions: ["js", "ts"],
preset: "ts-jest",
roots: ["<rootDir>/server"], //, "<rootDir>/client"],
testMatch: ["**/*.test.ts"],
roots: ["<rootDir>/server"],
testRegex: "\\.test\\.ts$",
verbose: true,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"compile": "tsc -b",
"compile:client": "tsc -b ./client/tsconfig.json",
"compile:server": "tsc -b ./server/tsconfig.json",
"test": "jest",
"test": "jest && cd client && npm test",
"test:ci": "jest --config=\"jest.ci.config.js\"",
"watch": "tsc -b -w",
"clean": "rimraf client/out && rimraf server/out",
Expand Down
Loading

0 comments on commit 48c1a47

Please sign in to comment.