From f3810d54fe64ead474521b4aa168ef8206e8a3b2 Mon Sep 17 00:00:00 2001 From: notaphplover Date: Sun, 20 Oct 2024 01:50:06 +0200 Subject: [PATCH 1/2] chore: add foundation-stryker-config root dependency --- package.json | 1 + packages/foundation/tools/stryker-config/lib/index.js | 10 +--------- packages/foundation/tools/stryker-config/package.json | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1006bc4..85e179c 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@inversifyjs/foundation-eslint-config": "workspace:*", "@inversifyjs/foundation-jest-config": "workspace:*", "@inversifyjs/foundation-scripts": "workspace:*", + "@inversifyjs/foundation-stryker-config": "workspace:*", "@inversifyjs/foundation-typescript-config": "workspace:*", "husky": "9.1.6", "lint-staged": "15.2.10", diff --git a/packages/foundation/tools/stryker-config/lib/index.js b/packages/foundation/tools/stryker-config/lib/index.js index 721ade8..91fab5c 100644 --- a/packages/foundation/tools/stryker-config/lib/index.js +++ b/packages/foundation/tools/stryker-config/lib/index.js @@ -13,15 +13,7 @@ export default { enableFindRelatedTests: true, projectType: 'custom', }, - mutate: [ - 'src/**/*.ts', - '!src/**/*.spec.ts', - '!src/**/*{Fixtures,Mocks}.ts', - '!src/**/adapter/nest/modules/*.ts', - '!src/**/adapter/typeorm/migrations/*.ts', - '!src/**/adapter/typeorm/scripts/*.ts', - '!src/**/application/controllers/*.ts', - ], + mutate: ['src/**/*.ts', '!src/**/*.spec.ts', '!src/**/*{Fixtures,Mocks}.ts'], packageManager: 'pnpm', plugins: [ '@stryker-mutator/jest-runner', diff --git a/packages/foundation/tools/stryker-config/package.json b/packages/foundation/tools/stryker-config/package.json index e8e1a3b..381dd87 100644 --- a/packages/foundation/tools/stryker-config/package.json +++ b/packages/foundation/tools/stryker-config/package.json @@ -10,7 +10,7 @@ "exports": "./lib/index.js", "homepage": "https://github.com/inversify/monorepo#readme", "license": "MIT", - "name": "@cornie-js/backend-stryker-config", + "name": "@inversifyjs/foundation-stryker-config", "private": true, "repository": { "type": "git", From a9fd02c78e54db1d0132a37fa2619c5616df5ac7 Mon Sep 17 00:00:00 2001 From: notaphplover Date: Sun, 20 Oct 2024 01:50:38 +0200 Subject: [PATCH 2/2] 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 2a9612c..31dbbe2 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 0000000..ec0166c --- /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 b4a52d3..5ac3e6e 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 0000000..c251339 --- /dev/null +++ b/packages/container/libraries/common/stryker.config.mjs @@ -0,0 +1,3 @@ +import config from '@inversifyjs/foundation-stryker-config'; + +export default config;