diff --git a/docs/in-depth/testing.md b/docs/in-depth/testing.md index caa3a76..85ace6e 100644 --- a/docs/in-depth/testing.md +++ b/docs/in-depth/testing.md @@ -60,7 +60,7 @@ In `package.json`, add a new `test-integration` script and add the new integrati ```json "scripts": { - "test": "export TS_NODE_PROJECT='./tsconfig.test.json' && npm run test-unit && npm run test-integration", + "test": "npm run test-unit && npm run test-integration", "test-integration": "npm run build && mocha test/integration/**/*.ts", } ``` diff --git a/package.json b/package.json index 00d52b1..1c5dbd6 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "push-main": "rollup -c --environment DEST:main", "push-pserver": "rollup -c --environment DEST:pserver", "push-sim": "rollup -c --environment DEST:sim", - "test": "export TS_NODE_PROJECT='./tsconfig.test.json' && npm run test-unit", + "test": "npm run test-unit", "test-unit": "mocha test/unit/**/*.ts", "test-integration": "echo 'See docs/in-depth/testing.md for instructions on enabling integration tests'", "watch-main": "rollup -cw --environment DEST:main", diff --git a/test/mocha.opts b/test/mocha.opts index 58c19f9..d387698 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,4 +1,4 @@ ---require test/setup-node.js +--require test/setup-mocha.js --require ts-node/register --require tsconfig-paths/register --ui bdd diff --git a/test/setup-node.js b/test/setup-mocha.js similarity index 75% rename from test/setup-node.js rename to test/setup-mocha.js index 1975df8..8d3ac8a 100644 --- a/test/setup-node.js +++ b/test/setup-mocha.js @@ -4,3 +4,6 @@ global.mocha = require('mocha'); global.chai = require('chai'); global.sinon = require('sinon'); global.chai.use(require('sinon-chai')); + +// Override ts-node compiler options +process.env.TS_NODE_PROJECT = 'tsconfig.test.json'