Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
}
}
```
Expand All @@ -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
Expand Down