add stryker for mutation testing

This commit is contained in:
Mike Rodarte 2025-04-07 21:03:08 -04:00
parent f346130ac3
commit 38c0a635d4
No known key found for this signature in database
GPG key ID: 32DCD8C789A592CC
5 changed files with 2223 additions and 53 deletions

View file

@ -47,6 +47,9 @@ jobs:
name: coverage-reports
path: coverage/
- name: Run mutation testing
run: npm run mutate
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:

6
.gitignore vendored
View file

@ -1,3 +1,5 @@
node_modules/
dist/
/coverage/
/dist/
/node_modules/
/reports/
/.stryker-tmp

2247
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,8 @@
"lint-fix": "eslint . --ext .js,.ts --fix",
"test": "jest",
"coverage": "npx jest --coverage",
"all": "npm run lint-fix && npm run format && npm run build && npm run coverage"
"mutate": "stryker run",
"all": "npm run lint-fix && npm run format && npm run build && npm run coverage && npm run mutate"
},
"repository": {
"type": "git",
@ -36,6 +37,8 @@
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"@stryker-mutator/core": "^8.7.1",
"@stryker-mutator/jest-runner": "^8.7.1",
"@types/jest": "^29.5.14",
"@types/jsdom": "^21.1.7",
"@types/node": "^22.13.9",

15
stryker.conf.json Normal file
View file

@ -0,0 +1,15 @@
{
"reporters": ["html", "clear-text", "progress"],
"testRunner": "jest",
"coverageAnalysis": "perTest",
"mutate": ["src/**/*.ts?(x)", "!src/__tests__/**/*.test.ts"],
"jest": {
"projectType": "custom"
},
"ignoreStatic": true,
"thresholds": {
"high": 90,
"low": 75,
"break": 65
}
}