Closed b-levinger closed 4 months ago
Summary
Stryker is not instrumenting "delete with nullable indexer" syntax correctly. Example source code delete myVariable?.[indexer] is instrumented as
delete myVariable?.[indexer]
delete (stryMutAct_9fa48("3390") ? myVariable[indexer] : (stryCov_9fa48("3390"), myVariable?.[indexer]));
This generated code does not operate the same as the original source causing the initial dry run test to fail.
One possible correct instrumentation would be the following:
if (stryMutAct_9fa48("3391") ? false : stryMutAct_9fa48("3390") ? true : (stryCov_9fa48("3390", "3391"), myVariable)) { if (stryMutAct_9fa48("3392")) { {} } else { stryCov_9fa48("3392"); delete myVariable[indexer]; } }
Stryker config
{ "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json", "_comment": "This config was generated using 'stryker init'. Please take a look at: https://stryker-mutator.io/docs/stryker-js/configuration/ for more information.", "packageManager": "npm", "checkers": ["typescript"], "tsconfigFile": "tsconfig.json", "typescriptChecker": { "prioritizePerformanceOverAccuracy": false }, "dryRunTimeoutMinutes": 25, "reporters": [ "html", "clear-text", "progress", "dashboard" ], "commandRunner": { "command": "npm run test:stryker" }, "cleanTempDir": true, "tempDirName": "stryker-tmp", "mutate": [ "src/**/*.ts" ], "testRunner": "jest", "testRunner_comment": "Take a look at https://stryker-mutator.io/docs/stryker-js/jest-runner for information about the jest plugin.", "coverageAnalysis": "all" }
Test runner config
Stryker environment
+-- @stryker-mutator/core@8.2.4 +-- @stryker-mutator/jest-runner@8.2.3 +-- @stryker-mutator/typescript-checker@8.2.3
+-- jest@29.7.0
Your Environment
Thanks! I will try to release a fix asap.
Released in 8.2.5 🚀
8.2.5
Summary
Stryker is not instrumenting "delete with nullable indexer" syntax correctly. Example source code
delete myVariable?.[indexer]
is instrumented asThis generated code does not operate the same as the original source causing the initial dry run test to fail.
One possible correct instrumentation would be the following:
Stryker config
Test runner config
Stryker environment
Your Environment