nodejs.org
nodejs.org copied to clipboard
fix(learn): Correct unclear example of passing arguments using the task runner
Description
Alters the phrasing used in the Passing arguments to the command section of the Run Node.js scripts from the command line page as it is incorrect:
Also, changes the example as current one can confuse the reader into thinking it's a good example of enabling the Node.js watch option even though it's just passing an '--watch' argument to the app.js script (node app.js --watch).
Current docs:
{
"type": "module",
"scripts": {
"start": "node app.js",
"dev": "node --run start -- --watch",
"test": "node --test"
}
}
[...]
In this case, the --watch argument is passed to the dev script.
Updated docs:
{
"type": "module",
"scripts": {
"start": "node app.js",
"test": "node --test",
"test:junit": "node --run test -- --test-reporter=\"junit\"",
}
}
[...]
In this case, the `--test-reporter` argument is passed to the `node --test` command defined by the `test` script.
Validation
- Run the example scripts locally
Related Issues
None
Check List
- [x] I have read the Contributing Guidelines and made commit messages that follow the guideline.
- [x] I have run
pnpm formatto ensure the code follows the style guide. - [x] I have run
pnpm testto check if all tests are passing. - [x] I have run
pnpm buildto check if the website builds without errors.