ITADN

Reporter progress-append-only isn't guaranteed to print final progress line in non-TTY mode

#5929OpenMaximSrour 创建于 2026-03-28
🐛 Bug
M
MaximSrourcommented
**Summary** The `progress-append-only` reporter does not emit a final progress line with the terminal mutant counts in non-TTY mode. The progress reporter will generally write (and overwrite) the progress line, leading to the eventual final stdout including: ```text stryker run ... Mutation testing [==================================================] 100% (elapsed: <1m, remaining: n/a) 1435/1435 Mutants tested (1 survived, 0 timed out) 10:16:04 (2642077) ERROR MutationTestReportHelper Final mutation score 99.93 under breaking threshold 100, setting exit code to 1 (failure). ... ``` However, when running in `progress-append-only`, the reporter only writes occasionally, leading to the following output: ```text stryker run | cat ... Mutation testing 31% (elapsed: <1m, remaining: <1m) 453/1435 tested (0 survived, 0 timed out) Mutation testing 46% (elapsed: <1m, remaining: <1m) 1176/1435 tested (0 survived, 0 timed out) 10:16:04 (2642077) ERROR MutationTestReportHelper Final mutation score 99.93 under breaking threshold 100, setting exit code to 1 (failure). ... ``` (Note that there is a surviving mutant in my personal codebase which goes unreported in the latter case) This means that if you are using the progress reporter only and are piping it through a non-TTY environment, it will potentially under-report issues, which can be problematic as the [default config for threshold break is null](https://stryker-mutator.io/docs/stryker-js/configuration/#thresholds-object). **Stryker config** ```json { "mutate": [ "src/**/*.ts", "!src/**/*.test.ts", "!src/index.ts", "!src/types.ts" ], "packageManager": "npm", "reporters": ["progress"], "testRunner": "vitest", "thresholds": { "break": 100 } } ``` **Test runner config** Vitest config: ```json { "test": { "include": ["src/**/*.test.ts"], "coverage": { "enabled": true }, "exclude": [ "**/node_modules/**", "**/dist/**", "**/coverage/**", "**/.stryker-tmp/**" ] } } ``` **Stryker environment** ```text +-- @stryker-mutator/core@9.6.0 +-- @stryker-mutator/vitest-runner@9.6.0 +-- vitest@4.0.18 ``` **Test runner environment** ```shell vitest run ``` ```json { "include": ["src/**/*.test.ts"], "coverage": { "enabled": true }, "exclude": [ "**/node_modules/**", "**/dist/**", "**/coverage/**", "**/.stryker-tmp/**" ] } ``` **Your Environment** | software | version(s) | | ---------------- | ---------------------------------------- | | node | v25.2.1 | | npm | 11.6.2 | | Operating System | Linux 6.17.0-19-generic x86_64 GNU/Linux | **Add stryker.log** ```text npm exec stryker run --fileLogLevel="trace" | cat npm warn Unknown cli config "--fileLogLevel". This will stop working in the next major version of npm. 10:15:36 (2642077) WARN ProjectReader Glob pattern "!src/types.ts" did not exclude any files. 10:15:36 (2642077) INFO ProjectReader Found 44 of 207 file(s) to be mutated. 10:15:36 (2642077) INFO Instrumenter Instrumented 44 source file(s) with 1460 mutant(s) 10:15:37 (2642077) INFO ConcurrencyTokenProvider Creating 23 test runner process(es). 10:15:37 (2642077) INFO BroadcastReporter Detected that current console does not support the "progress" reporter, downgrading to "progress-append-only" reporter 10:15:37 (2642077) INFO DryRunExecutor Starting initial test run (vitest test runner with "perTest" coverage analysis). This may take a while. 10:15:40 (2642077) INFO DryRunExecutor Initial test run succeeded. Ran 292 tests in 2 seconds (net 175.1254440000008 ms, overhead 2346.8745559999993 ms). 10:15:40 (2642077) WARN MutantTestPlanner Detected 52 static mutants (4% of total) that are estimated to take 47% of the time running the tests! You might want to enable "ignoreStatic" to ignore these static mutants for your next run. For more information about static mutants visit: https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants (disable "warnings.slow" to ignore this warning) Mutation testing 31% (elapsed: <1m, remaining: <1m) 453/1435 tested (0 survived, 0 timed out) Mutation testing 46% (elapsed: <1m, remaining: <1m) 1176/1435 tested (0 survived, 0 timed out) 10:16:04 (2642077) ERROR MutationTestReportHelper Final mutation score 99.93 under breaking threshold 100, setting exit code to 1 (failure). 10:16:04 (2642077) INFO MutationTestReportHelper (improve mutation score or set `thresholds.break = null` to prevent this error in the future) 10:16:04 (2642077) INFO MutationTestExecutor Done in 28 seconds. ```
1 条评论