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.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Review | Updated (UTC) |
|---|---|---|---|
| nodejs-org | Preview | Dec 13, 2025 9:23pm |
👋 Codeowner Review Request
The following codeowners have been identified for the changed files:
Team reviewers: @nodejs/nodejs-website
Please review the changes when you have a chance. Thank you! 🙏
(On an unrelated note: it's my first time opening a PR on this repo and I noticed that nearly nobody follows the commit message guideline of starting the commit message with a capital letter.)
(On an unrelated note: it's my first time opening a PR on this repo and I noticed that nearly nobody follows the commit message guideline of starting the commit message with a capital letter.)
There's no such rule, to my understanding? Could you reference it?
(On an unrelated note: it's my first time opening a PR on this repo and I noticed that nearly nobody follows the commit message guideline of starting the commit message with a capital letter.)
There's no such rule, to my understanding? Could you reference it?
Sorry I forgot the link in my comment: https://github.com/nodejs/nodejs.org/blob/main/docs/code-style.md#commit-message-format
I think that's a mistake, all characters should be lower case, except if it's a name, IMO
I'm struggling to understand why the example you're giving is better suited for the example. Could you point out why these changes are better on demonstrating how to run scripts with node --run?
There are two different (minor) issues:
- This line of text is wrong:
In this case, the
--watchargument is passed to thedevscript.
Saying it's passed to the start would be more accurate. (or even: to the app.js script)
- The example used resolves to
node app.js --watchbeing executed: while it's a valid command I find it confusing because it doesn't do what the reader could think it does. It's not the same asnode --watch app.js, the node option introduced in the section right above this one. Instead it passes the argument toapp.jsscript. So I tried to find another simple example that relied on the existing package.json scripts. That's all !
I think that's a mistake, all characters should be lower case, except if it's a name, IMO
Ok, I'll open another PR to amend the guidelines in that direction :thumbsup:.