From e00667ff480c61b4cc1f41624102a1fe4f0377b5 Mon Sep 17 00:00:00 2001 From: Mike Kreiser Date: Sat, 21 Oct 2023 15:15:07 -0400 Subject: [PATCH] Properly configure unit test script to improve local dev --- jest-integration-tests.config.js | 10 ++++++++++ jest.config.js | 1 + package.json | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 jest-integration-tests.config.js diff --git a/jest-integration-tests.config.js b/jest-integration-tests.config.js new file mode 100644 index 0000000..a5abfc0 --- /dev/null +++ b/jest-integration-tests.config.js @@ -0,0 +1,10 @@ +module.exports = { + clearMocks: true, + collectCoverage: false, + restoreMocks: true, + testEnvironment: 'node', + testMatch: ['**/integration-tests/**/?(*.)+(spec|test).[jt]s?(x)'], + transform: { + '^.+\\.js$': 'babel-jest' + } +}; diff --git a/jest.config.js b/jest.config.js index e82bbe8..6cd854b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,6 +11,7 @@ module.exports = { coverageDirectory: 'coverage', restoreMocks: true, testEnvironment: 'node', + testMatch: ['**/src/**/?(*.)+(spec|test).[jt]s?(x)'], transform: { '^.+\\.js$': 'babel-jest' } diff --git a/package.json b/package.json index e4b8b0a..ceedd74 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "lint": "eslint integration-tests/**/*.js src/**/*.js", "prepublishOnly": "npm run build", "serve:docs": "npm run build:docs && http-server ./docs -c-1", - "test": "jest src --maxWorkers=2", - "test:integration": "jest integration-tests --maxWorkers=2 --coverage=false" + "test": "jest --maxWorkers=2", + "test:integration": "jest --maxWorkers=2 --config=jest-integration-tests.config.js" }, "repository": { "type": "git",