From a7e07110a5a0e80a00e5d0a5dbf976f2e9e17e42 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sun, 17 Jul 2022 11:18:45 -0400 Subject: [PATCH] try it --- nyc-run.config.js | 12 ++++++++++++ package.json | 4 +++- src/test/helpers.ts | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 nyc-run.config.js diff --git a/nyc-run.config.js b/nyc-run.config.js new file mode 100644 index 000000000..a84780504 --- /dev/null +++ b/nyc-run.config.js @@ -0,0 +1,12 @@ +module.exports = { + all: true, + include: ['tests/node_modules/ts-node/**'], + exclude: ['**/*.d.ts', 'tests/node_modules/ts-node/node_modules/**'], + extension: [], + instrument: false, + 'hook-require': false, + 'hook-run-in-context': false, + 'hook-run-in-this-context': false, + excludeNodeModules: false, + excludeAfterRemap: false, +}; diff --git a/package.json b/package.json index 9b4688a58..c9c13d2e2 100644 --- a/package.json +++ b/package.json @@ -68,10 +68,12 @@ "build-configSchema": "typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema", "build-pack": "node ./scripts/build-pack.js", "test-spec": "ava", - "test-cov": "nyc ava", + "test-instrument": "nyc instrument --in-place ./tests/node_modules/ts-node", + "test-cov": "nyc --nycrc-path ./nyc-run.config.js ava", "test": "npm run build && npm run lint && npm run test-cov --", "test-local": "npm run lint-fix && npm run build-tsc && npm run build-pack && npm run test-spec --", "pre-debug": "npm run build-tsc && npm run build-pack", + "coverage-summary": "nyc report", "coverage-report": "nyc report --reporter=lcov", "prepare": "npm run clean && npm run build-nopack", "api-extractor": "api-extractor run --local --verbose", diff --git a/src/test/helpers.ts b/src/test/helpers.ts index c9130c23b..ede7bf4d5 100644 --- a/src/test/helpers.ts +++ b/src/test/helpers.ts @@ -122,6 +122,9 @@ export async function installTsNode() { try { rimrafSync(join(TEST_DIR, 'node_modules')); await promisify(childProcessExec)(`npm install`, { cwd: TEST_DIR }); + await promisify(childProcessExec)(`npm run test-instrument`, { + cwd: ROOT_DIR, + }); const packageLockPath = join(TEST_DIR, 'package-lock.json'); existsSync(packageLockPath) && unlinkSync(packageLockPath); break;