nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
104.51k stars 28.19k forks source link

cli: allow `--test-[name/skip]-pattern` in `NODE_OPTIONS` #53001

Open RedYetiDev opened 2 weeks ago

RedYetiDev commented 2 weeks ago

workaround for #51384

NODE_OPTIONS="--test-name-pattern=XXX" node my_test.js

Allows --test-name-pattern and --test-skip-pattern to appear in the NODE_OPTIONS environment variable.

cjihrig commented 2 weeks ago

Just an FYI - this does not fix #51384.

RedYetiDev commented 2 weeks ago

Just an FYI - this does not fix #51384.

Why? If these options can be passed as env variables, then they won't be hostile to NPM scripts, as they can be used in the variable? Right?

cjihrig commented 2 weeks ago

The ask in that issue is to be able to run something like npm test -- --test-name-pattern="my pattern". More generally (based on feedback I've received), people want to be able to mix test runner arguments in process.execArgv and process.argv.

I'm not saying this is a bad change, but this is not what is being requested and I don't think people will be satisfied with it for that use case.