diff --git a/docs/config/index.md b/docs/config/index.md index a2043a15b..01164d4cc 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -724,9 +724,14 @@ Similar as `vmThreads` pool but uses `child_process` instead of `worker_threads` - **Type:** `string[]` - **Default:** `[]` +- **CLI:** `--execArgv= --execArgv=` Pass additional arguments to `node` in the runner worker. See [Command-line API | Node.js](https://nodejs.org/docs/latest/api/cli.html) for more information. +```sh +vitest --execArgv=--cpu-prof --execArgv=--cpu-prof-dir=./cpu-profile +``` + :::warning Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103. ::: diff --git a/packages/vitest/src/node/cli/cli-config.ts b/packages/vitest/src/node/cli/cli-config.ts index d72ff4508..9e75938b8 100644 --- a/packages/vitest/src/node/cli/cli-config.ts +++ b/packages/vitest/src/node/cli/cli-config.ts @@ -408,6 +408,7 @@ export const cliOptionsConfig: VitestCLIOptions = { execArgv: { description: 'Pass additional arguments to `node` process when spawning `worker_threads` or `child_process`.', argument: '