diff --git a/.vscode/launch.json b/.vscode/launch.json index aaf60d06e..31a833827 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -44,10 +44,8 @@ "bdd", "--colors", "--diff", - "-r", - "ts-node/register", - "-r", - "test/mocha.setup.js", + "--config", + ".mocharc.json", "test/pure-tests/**/*.ts" ], "stopOnEntry": false, diff --git a/extensions/ql-vscode/.mocharc.json b/extensions/ql-vscode/.mocharc.json new file mode 100644 index 000000000..c5b75cac2 --- /dev/null +++ b/extensions/ql-vscode/.mocharc.json @@ -0,0 +1,6 @@ +{ + "exit": true, + "require": [ + "test/mocha.setup.js" + ] +} diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index b5a0da12e..d0e0e205c 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -1248,7 +1248,7 @@ "watch:extension": "tsc --watch", "watch:webpack": "gulp watchView", "test": "npm-run-all -p test:*", - "test:unit": "mocha --exit -r ts-node/register -r test/mocha.setup.js test/pure-tests/**/*.ts", + "test:unit": "mocha --config .mocharc.json test/pure-tests/**/*.ts", "test:view": "jest", "preintegration": "rm -rf ./out/vscode-tests && gulp", "integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace", diff --git a/extensions/ql-vscode/test/mocha.setup.js b/extensions/ql-vscode/test/mocha.setup.js index e47168552..392e00d79 100644 --- a/extensions/ql-vscode/test/mocha.setup.js +++ b/extensions/ql-vscode/test/mocha.setup.js @@ -1,2 +1,8 @@ +const path = require('path'); + +require('ts-node').register({ + project: path.resolve(__dirname, 'tsconfig.json') +}) + process.env.TZ = 'UTC'; process.env.LANG = 'en-US'; diff --git a/extensions/ql-vscode/test/tsconfig.json b/extensions/ql-vscode/test/tsconfig.json index 70b548578..9e8233e93 100644 --- a/extensions/ql-vscode/test/tsconfig.json +++ b/extensions/ql-vscode/test/tsconfig.json @@ -1,8 +1,9 @@ { - "include": [ - "**/*.ts" - ], + "extends": "../tsconfig.json", + "include": ["**/*.ts"], + "exclude": [], "compilerOptions": { - "noEmit": true + "noEmit": true, + "resolveJsonModule": true } }