Skip to content

@stryker-mutator/tap-runner has unexpected interaction with the Node.js v24 build-in test runner #5287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ericcornelissen opened this issue May 11, 2025 · 3 comments · Fixed by #5302
Labels
🐛 Bug Something isn't working

Comments

@ericcornelissen
Copy link
Contributor

Summary

When upgrading from Node.js v22 to v24, the interaction between @stryker-mutator/tap-runner and Node's build-in test runner changed and now it reports n/a for tests with a 100% mutation score.

I have observed this behavior in two separate projects with (more or less) the same test setup:

Stryker config

export default {
	coverageAnalysis: "perTest",
	inPlace: false,
	timeoutMS: 5000,

	mutate: [
		"src/**/*.js",
		"!src/**/*.test.js",
		"!src/main.js",
	],

	testRunner: "tap",
	tap: {
		testFiles: ["src/*.test.js"],
		forceBail: true,
	},

	incremental: true,
	incrementalFile: "node_modules/.cache/stryker-incremental.json",

	reporters: ["clear-text", "html", "progress"],
	htmlReporter: {
		fileName: "mutation.html",
	},

	thresholds: {
		high: 100,
		low: 96,
		break: 96,
	},

	tempDirName: "node_modules/.temp/stryker",
	cleanTempDir: true,
};

Test runner config

n/a

Stryker environment

├── @stryker-mutator/[email protected]
├── @stryker-mutator/[email protected]

Test runner environment

node --test 'src/*.test.js'

Your Environment

software version(s)
node 24.0.0
npm 11.3.0
Operating System Ubuntu 24.04

Add stryker.log

stryker.log

@ericcornelissen ericcornelissen added the 🐛 Bug Something isn't working label May 11, 2025
@nicojs
Copy link
Member

nicojs commented May 12, 2025

Hi @ericcornelissen 👋

Hmm, interesting. The default --test-reporter changed in Node since node 23 from tap to spec. I can see it in the docs:
https://nodejs.org/api/test.html#test-reporters. It changed here: nodejs/node@eb7e18fe94, but I don't see it in the history table in the docs, so I just spent an hour second-guessing myself 😪

A simple workaround for now is to apply this diff:

diff --git a/.stryker.js b/.stryker.js
index 7c3386d..4683c98 100644
--- a/.stryker.js
+++ b/.stryker.js
@@ -14,6 +14,7 @@ export default {
        testRunner: "tap",
        tap: {
                testFiles: ["src/*.test.js"],
+               nodeArgs: ["-r", "{{hookFile}}", "--test-reporter", "tap", "{{testFile}}"],
                forceBail: true,
        },

We should document this and maybe provide --test-reporter tap as default.

@ericcornelissen
Copy link
Contributor Author

Thanks you for figuring that out @nicojs 🙇

@nicojs
Copy link
Member

nicojs commented May 14, 2025

Upgrading to StrykerJS 9 should fix it without you having to change your config file :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants