From 8776c1bb91d7136cf945179a00cf40847b9c413f Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 11 Jan 2022 17:17:53 +0000 Subject: [PATCH] make mocha pick up individual tsconfig, compile test files --- package.json | 22 +++++++++++----------- test/integration/tsconfig.json | 18 ++++++++++-------- test/unit/tsconfig.json | 18 ++++++++++-------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 0a1d5c32..733d16fd 100644 --- a/package.json +++ b/package.json @@ -26,18 +26,18 @@ "release": "release-it --non-interactive", "changelog": "auto-changelog -p", "prepublishOnly": "npm run build", - "test:ss": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/ssContracts/SideStaking.test.ts'", - "test:fixed": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/fixedRate/FixedRateExchange.test.ts'", - "test:pool": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/balancer/Pool.test.ts'", - "test:dispenser": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/dispenser/Dispenser.test.ts'", - "test:dt": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/tokens/Datatoken.test.ts'", - "test:nftDt": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/Nft.test.ts'", - "test:factory": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/NftFactory.test.ts'", - "test:router": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/Router.test.ts'", - "test:publishAll": "mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/PublishFlows.test.ts'", - "test:unit": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/**/*.test.ts'", + "test:ss": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/ssContracts/SideStaking.test.ts'", + "test:fixed": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/fixedRate/FixedRateExchange.test.ts'", + "test:pool": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/balancer/Pool.test.ts'", + "test:dispenser": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/dispenser/Dispenser.test.ts'", + "test:dt": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/tokens/Datatoken.test.ts'", + "test:nftDt": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/Nft.test.ts'", + "test:factory": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/NftFactory.test.ts'", + "test:router": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/pools/Router.test.ts'", + "test:publishAll": "TS_NODE_PROJECT='./test/integration/tsconfig.json' mocha --require ts-node/register --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/PublishFlows.test.ts'", + "test:unit": "TS_NODE_PROJECT='./test/unit/tsconfig.json' mocha --require ts-node/register --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/**/*.test.ts'", "test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit", - "test:integration": "mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/**/*.test.ts'", + "test:integration": "TS_NODE_PROJECT='./test/integration/tsconfig.json' mocha --require ts-node/register --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/**/*.test.ts'", "test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration" }, "repository": { diff --git a/test/integration/tsconfig.json b/test/integration/tsconfig.json index 4bb727a0..be3cb20f 100644 --- a/test/integration/tsconfig.json +++ b/test/integration/tsconfig.json @@ -1,9 +1,11 @@ { - "compilerOptions": { - "resolveJsonModule": true, - "lib": ["es6", "es7"], - "noUnusedLocals": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - } - } \ No newline at end of file + "compilerOptions": { + "resolveJsonModule": true, + "lib": ["es6", "es7"], + "module": "CommonJS", + "target": "ES5", + "noUnusedLocals": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + } +} diff --git a/test/unit/tsconfig.json b/test/unit/tsconfig.json index 06adfeea..ecf2e1d5 100644 --- a/test/unit/tsconfig.json +++ b/test/unit/tsconfig.json @@ -1,9 +1,11 @@ { - "compilerOptions": { - "resolveJsonModule": true, - "lib": ["es6", "es7"], - "noUnusedLocals": false, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - } - } \ No newline at end of file + "compilerOptions": { + "resolveJsonModule": true, + "lib": ["es6", "es7"], + "module": "CommonJS", + "target": "ES5", + "noUnusedLocals": false, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + } +}