node icon indicating copy to clipboard operation
node copied to clipboard

add "test" namespace to node.config.json

Open marco-ippolito opened this issue 9 months ago • 4 comments

What is the problem this feature will solve?

I was suggested a few times that a test namespace would be beneficial for the test runner. It could fix issues like https://github.com/nodejs/node/issues/51384

What is the feature you are proposing to solve the problem?

A test namespace with configurations for the test runner, for coverage, filtering etc... Still need to create a draft of what it could look like

What alternatives have you considered?

none

cc @nodejs/test_runner @cjihrig

marco-ippolito avatar Mar 20 '25 15:03 marco-ippolito

For additional context:

#51384 is a fairly simple issue to fix from a technical standpoint - allow the test runner to read flags from process.argv instead of only reading from process.execArgv. However, I don't think that should ever be the default behavior because it is inconsistent with how every other Node.js flag is handled. I also don't think it makes sense to add a dedicated CLI flag for that behavior.

If the new config file was capable of setting options that do not correspond to CLI flags, I think this would be a good fit.

cjihrig avatar Mar 20 '25 16:03 cjihrig

I also wonder if the config file can accept code and not just json values, for example for defining global test hooks, or global state & setup

MoLow avatar Mar 23 '25 21:03 MoLow

I also wonder if the config file can accept code and not just json values, for example for defining global test hooks, or global state & setup

Its a json file so they have to be json properties but you can setup a hook pointing to a file like loaders

marco-ippolito avatar Mar 24 '25 06:03 marco-ippolito

https://github.com/nodejs/node/pull/58073 ← here's a first "poc". I'm still working on this, and any kind of feedback is more than welcome! This is the first step... I'm also working on adding support for "kDisallowedInEnvvar" options.

pmarchini avatar May 03 '25 14:05 pmarchini

Hi! I'm new to the project and would love to contribute. Could you please confirm if this issue only involves adding a new top-level test key to node.config.json, or are there additional files or changes involved? Just want to be sure I'm approaching it correctly. Thanks!

viky-01 avatar May 15 '25 03:05 viky-01

Hey @viky-01, it's great that you want to contribute, and you're definitely welcome to work on this issue too :)

Just one thing: I'm already working on this, as mentioned in my previous comment, and I’d like to avoid having two people working on the same problem at the same time.

That said, you're more than welcome to contribute to this issue, and your input will be greatly appreciated! šŸš€

pmarchini avatar May 15 '25 11:05 pmarchini

Resolved by https://github.com/nodejs/node/pull/58073

marco-ippolito avatar Jun 09 '25 08:06 marco-ippolito