Skip to content

Commit 95eb334

Browse files
committed
fix(learn): Correct unclear example of passing arguments with the task runner
Fix the example used in the 'Passing arguments to the command' section of the 'Run Node.js scripts from the command line' as it is not referencing the right package.json script. Also, change the script used in the example ('node app.js --watch') as it can confuse the reader into thinking it's a way to enable the Node.js watch option even though it's just passing an '--watch' argument to the app.js script.
1 parent db65366 commit 95eb334

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

apps/site/pages/en/learn/command-line/run-nodejs-scripts-from-the-command-line.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ The [`--run`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--run) flag allo
7171
"type": "module",
7272
"scripts": {
7373
"start": "node app.js",
74-
"dev": "node --run start -- --watch",
75-
"test": "node --test"
74+
"test": "node --test",
75+
"test:junit": "node --run test -- --test-reporter=\"junit\""
7676
}
7777
}
7878
```
@@ -85,12 +85,13 @@ node --run test
8585

8686
### Passing arguments to the command
8787

88-
Let's explain the `dev` key in the `scripts` object of the `package.json` file.
88+
Let's explain the `test:junit` key in the `scripts` object of the `package.json` file.
8989

90-
The syntax `-- --another-argument` is used to pass arguments to the command. In this case, the `--watch` argument is passed to the `dev` script.
90+
The syntax `-- --another-argument` is used to pass arguments to the command. In this case, the `--test-reporter` argument is passed to the `node --test` command defined by the `test` script.
9191

9292
```bash
93-
node --run dev
93+
# Executes: node --test --test-reporter="junit"
94+
node --run test:junit
9495
```
9596

9697
### Environment variables

0 commit comments

Comments
 (0)