modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.22k stars 291 forks source link

Allow passing custom arguments to CLI #2687

Open DavidPeicho opened 7 months ago

DavidPeicho commented 7 months ago

It's pretty common for me to pass custom arguments to the web-test-runner.config.js spawn:

npm run test -- --custom_path custom/path/to/something

However, it looks like process.argv is fully handled before invoking the configuration script. I think it could be valuable to allow passing custom arguments, process them in the config step, and ignore them in the CLI?

The only workaround that comes to my mind would be to wrap the CLI in another node script that handles process.argv, and forward what is necessary to the CLI.

DavidPeicho commented 7 months ago

After digging in the code a bit, I realize that it's achievable via a custom script calling startTestRunner. If there could be a more direct way, that would even be better. Otherwise that will do :)