From 95eb3349fc0f75dfc750691b760c0981f67b03b2 Mon Sep 17 00:00:00 2001 From: fellowseb Date: Sat, 13 Dec 2025 21:02:00 +0100 Subject: [PATCH] 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. --- .../run-nodejs-scripts-from-the-command-line.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/site/pages/en/learn/command-line/run-nodejs-scripts-from-the-command-line.md b/apps/site/pages/en/learn/command-line/run-nodejs-scripts-from-the-command-line.md index 67d1723721673..cbfd55c534aff 100644 --- a/apps/site/pages/en/learn/command-line/run-nodejs-scripts-from-the-command-line.md +++ b/apps/site/pages/en/learn/command-line/run-nodejs-scripts-from-the-command-line.md @@ -71,8 +71,8 @@ The [`--run`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--run) flag allo "type": "module", "scripts": { "start": "node app.js", - "dev": "node --run start -- --watch", - "test": "node --test" + "test": "node --test", + "test:junit": "node --run test -- --test-reporter=\"junit\"" } } ``` @@ -85,12 +85,13 @@ node --run test ### Passing arguments to the command -Let's explain the `dev` key in the `scripts` object of the `package.json` file. +Let's explain the `test:junit` key in the `scripts` object of the `package.json` file. -The syntax `-- --another-argument` is used to pass arguments to the command. In this case, the `--watch` argument is passed to the `dev` script. +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. ```bash -node --run dev +# Executes: node --test --test-reporter="junit" +node --run test:junit ``` ### Environment variables