diff --git a/.vscode/launch.json b/.vscode/launch.json index 573753853bb5e..fa27febeea023 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -108,11 +108,11 @@ "name": "Run Mocha Test", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "args": [ - "${file}", "--no-timeouts", "--colors", "--opts", - "${workspaceRoot}/configs/mocha.opts" + "${workspaceRoot}/configs/mocha.opts", + "**/${fileBasenameNoExtension}.js" ], "env": { "TS_NODE_PROJECT": "${workspaceRoot}/tsconfig.json" diff --git a/configs/mocha.opts b/configs/mocha.opts index b487035eec14f..ef23a43a792c7 100644 --- a/configs/mocha.opts +++ b/configs/mocha.opts @@ -1,6 +1,5 @@ --require ignore-styles --require monaco-languageclient/lib/register-vscode ---require ts-node/register --require reflect-metadata/Reflect --reporter spec ---watch-extensions ts \ No newline at end of file +--watch-extensions js diff --git a/dev-packages/ext-scripts/package.json b/dev-packages/ext-scripts/package.json index 28bda586f7197..1e70fcfe3263e 100644 --- a/dev-packages/ext-scripts/package.json +++ b/dev-packages/ext-scripts/package.json @@ -25,8 +25,8 @@ "ext:watch": "tsc -w -p compile.tsconfig.json", "ext:docs": "typedoc --tsconfig ../../configs/typedoc-tsconfig.json --options ../../configs/typedoc.json src", "ext:docs:clean": "rimraf docs/api", - "ext:test": "nyc mocha --opts ../../configs/mocha.opts \"./src/**/*.*spec.ts\"", - "ext:test:watch": "mocha -w --opts ../../configs/mocha.opts \"./src/**/*.*spec.ts\"", + "ext:test": "nyc mocha --opts ../../configs/mocha.opts \"./lib/**/*.*spec.js\"", + "ext:test:watch": "mocha -w --opts ../../configs/mocha.opts \"./lib/**/*.*spec.js\"", "ext:test:clean": "rimraf .nyc_output && rimraf coverage" } } diff --git a/doc/Testing.md b/doc/Testing.md index f5706b42988b4..571ccd0502386 100644 --- a/doc/Testing.md +++ b/doc/Testing.md @@ -2,6 +2,8 @@ ## Running tests +Before running make sure to compile tests with `compile` or `watch` scripts. + To run tests on theia run: `yarn test` @@ -12,6 +14,7 @@ If you want to run all tests for a particular Theia extension, execute the follo `npx run test @theia/extension-name` + Add the following npm script to the `package.json` of the desired Theia extension, if you would like to enable the watch mode for the tests. ```json diff --git a/packages/keymaps/compile.tsconfig.json b/packages/keymaps/compile.tsconfig.json index 91ea1015832d3..a23513b5e6b13 100644 --- a/packages/keymaps/compile.tsconfig.json +++ b/packages/keymaps/compile.tsconfig.json @@ -6,8 +6,5 @@ }, "include": [ "src" - ], - "exclude": [ - "**/*.spec.ts" ] -} \ No newline at end of file +} diff --git a/packages/process/src/node/raw-process.spec.ts b/packages/process/src/node/raw-process.spec.ts index 3bc6282872fe8..e9d9aab7e89ef 100644 --- a/packages/process/src/node/raw-process.spec.ts +++ b/packages/process/src/node/raw-process.spec.ts @@ -31,7 +31,7 @@ const track = temp.track(); */ const expect = chai.expect; -const FORK_TEST_FILE = path.join(__dirname, 'test', 'process-fork-test.js'); +const FORK_TEST_FILE = path.join(__dirname, '../../src/node/test/process-fork-test.js'); describe('RawProcess', function () {