From a9fd02c78e54db1d0132a37fa2619c5616df5ac7 Mon Sep 17 00:00:00 2001 From: notaphplover Date: Sun, 20 Oct 2024 01:50:38 +0200 Subject: [PATCH] chore(common): add test mutation script --- packages/container/libraries/common/.gitignore | 3 +++ .../container/libraries/common/jest.config.stryker.mjs | 9 +++++++++ packages/container/libraries/common/package.json | 4 ++++ packages/container/libraries/common/stryker.config.mjs | 3 +++ 4 files changed, 19 insertions(+) create mode 100644 packages/container/libraries/common/jest.config.stryker.mjs create mode 100644 packages/container/libraries/common/stryker.config.mjs diff --git a/packages/container/libraries/common/.gitignore b/packages/container/libraries/common/.gitignore index 2a9612cb..31dbbe24 100644 --- a/packages/container/libraries/common/.gitignore +++ b/packages/container/libraries/common/.gitignore @@ -6,6 +6,9 @@ # Test coverage report /coverage +# Test mutation report +/reports + # node modules /node_modules/ diff --git a/packages/container/libraries/common/jest.config.stryker.mjs b/packages/container/libraries/common/jest.config.stryker.mjs new file mode 100644 index 00000000..ec0166c4 --- /dev/null +++ b/packages/container/libraries/common/jest.config.stryker.mjs @@ -0,0 +1,9 @@ +import { getJestTsProjectConfig } from '@inversifyjs/foundation-jest-config'; + +const tsGlobalConfig = getJestTsProjectConfig( + 'All', + ['/node_modules', '.int.spec.ts'], + '.spec.ts', +); + +export default tsGlobalConfig; diff --git a/packages/container/libraries/common/package.json b/packages/container/libraries/common/package.json index b4a52d39..5ac3e6e1 100644 --- a/packages/container/libraries/common/package.json +++ b/packages/container/libraries/common/package.json @@ -7,6 +7,9 @@ "devDependencies": { "@eslint/js": "9.13.0", "@jest/globals": "29.7.0", + "@stryker-mutator/core": "8.6.0", + "@stryker-mutator/jest-runner": "8.6.0", + "@stryker-mutator/typescript-checker": "8.6.0", "@types/node": "20.16.13", "@typescript-eslint/eslint-plugin": "8.10.0", "@typescript-eslint/parser": "8.10.0", @@ -56,6 +59,7 @@ "test:integration:js": "pnpm run test:js --selectProjects Integration", "test:js": "jest --config=jest.js.config.mjs --runInBand", "test:js:coverage": "pnpm run test:unit:js --coverage", + "test:mutation": "stryker run", "test:uncommitted": "pnpm run test --changedSince=HEAD", "test:unit:js": "pnpm run test:js --selectProjects Unit" }, diff --git a/packages/container/libraries/common/stryker.config.mjs b/packages/container/libraries/common/stryker.config.mjs new file mode 100644 index 00000000..c2513393 --- /dev/null +++ b/packages/container/libraries/common/stryker.config.mjs @@ -0,0 +1,3 @@ +import config from '@inversifyjs/foundation-stryker-config'; + +export default config;