`TypeError: acc[key].push is not a function` in mutation-testing-metrics
🐛 Bug
**Summary**
After [upgrading from 9.4.0 to 9.5.0](https://github.com/ericcornelissen/shescape/pull/2355) Stryker started unexpectedly failing with the following error:
```log
TypeError: acc[key].push is not a function
at file:///home/runner/work/shescape/shescape/node_modules/mutation-testing-metrics/dist/src/helpers/group-by.js:5:18
at Array.reduce (<anonymous>)
at groupBy (file:///home/runner/work/shescape/shescape/node_modules/mutation-testing-metrics/dist/src/helpers/group-by.js:2:16)
at toChildModels (file:///home/runner/work/shescape/shescape/node_modules/mutation-testing-metrics/dist/src/calculateMetrics.js:60:30)
at calculateDirectoryMetrics (file:///home/runner/work/shescape/shescape/node_modules/mutation-testing-metrics/dist/src/calculateMetrics.js:53:26)
at calculateRootMetrics (file:///home/runner/work/shescape/shescape/node_modules/mutation-testing-metrics/dist/src/calculateMetrics.js:48:16)
at calculateMutationTestMetrics (file:///home/runner/work/shescape/shescape/node_modules/mutation-testing-metrics/dist/src/calculateMetrics.js:30:26)
at MutationTestReportHelper.reportAll (file:///home/runner/work/shescape/shescape/node_modules/@stryker-mutator/core/dist/src/reporters/mutation-test-report-helper.js:104:25)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
at async MutationTestExecutor.execute (file:///home/runner/work/shescape/shescape/node_modules/@stryker-mutator/core/dist/src/process/4-mutation-test-executor.js:59:9)
at async Stryker.run (file:///home/runner/work/shescape/shescape/node_modules/@stryker-mutator/core/dist/src/stryker.js:55:39)
at async Stryker.runMutationTest (file:///home/runner/work/shescape/shescape/node_modules/@stryker-mutator/core/dist/src/stryker.js:27:20)
at async Command.<anonymous> (file:///home/runner/work/shescape/shescape/node_modules/@stryker-mutator/core/dist/src/stryker-cli.js:43:13)
```
Interestingly, I use Stryker twice in this repo and [one](https://github.com/ericcornelissen/shescape/blob/b4b4ace939658f228e4279de62e556ccd5d142ea/package.json#L141) works while [the other](https://github.com/ericcornelissen/shescape/blob/b4b4ace939658f228e4279de62e556ccd5d142ea/package.json#L142) doesn't. I also have applied the same update to two other projects without any problems.
I tried updating all dependencies to latest (with `npm update`) as well as a fresh install of all Styker dependencies but neither resolved the problem.
**Stryker config**
<!--- Please place your stryker config below. Feel free to change paths in the files and mutate arrays if you cannot share them. -->
```js
export default {
coverageAnalysis: "perTest",
inPlace: false,
mutate: ["src/*.js"],
testRunner: "tap",
tap: {
testFiles: ["test/integration/**/*.test.js"],
forceBail: false,
nodeArgs: [
"node_modules/ava/entrypoints/cli.mjs",
"--tap",
"--node-arguments='-r {{hookFile}}'",
],
},
incremental: true,
incrementalFile: ".cache/stryker-incremental-integration.json",
timeoutMS: 10_000,
reporters: ["clear-text", "html", "progress"],
htmlReporter: {
fileName: "_reports/mutation/integration.html",
},
thresholds: {
high: 100,
low: 100,
break: 100,
},
tempDirName: ".temp/stryker-integration",
cleanTempDir: true,
};
```
**Test runner config**
<!--- Please Put your Jest / Karma / Jasmine / Mocha (...) configuration here. -->
n/a
**Stryker environment**
<!-- Please list your stryker plugins + versions here (output of `npm ls | grep stryker` or `npm ls | findstr "stryker"` on Windows) -->
```
├── @stryker-mutator/core@9.5.0
├── @stryker-mutator/tap-runner@9.5.0
```
<!-- Please also add the test runner you are using. Examples:-->
```
├── ava@6.4.1
```
**Test runner environment**
<!-- Please add your test command here (probably the command you use in `npm test`) command -->
```shell
npm run transpile && ava test/integration/**/*.test.js --timeout 2m
```
<!-- Please add any config files that are used by your test runner. For example jest.config.js, karma.conf.js, angular.json, mocha.opts, ... -->
<!--
```json
```
-->
**Your Environment**
| software | version(s)
| ---------------- | -------
| node | 24.13.0
| npm | 11.6.2
| Operating System | Ubuntu 24.04
**Add stryker.log**
<!-- Please add your stryker.log file. This file can be generated using `stryker run --fileLogLevel trace`. You can drag and drop it here. -->
<!-- Your source code is never logged to this file, however file names are logged. Feel free to obfuscate those log messages if you think it is a problem -->
[stryker.log](https://github.com/user-attachments/files/25010648/stryker.log)
5 条评论