From 63c62f9e6f0839ea5d9091c38c8fe6b1f890e452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Sat, 18 Mar 2023 22:55:54 +0200 Subject: [PATCH] feat: `--test-timeout` CLI argument (#3019) --- docs/config/index.md | 1 + docs/guide/debugging.md | 4 ++++ packages/vitest/src/node/cli.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/docs/config/index.md b/docs/config/index.md index 16675e53fcc8..0c58ae163520 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -536,6 +536,7 @@ This can improve performance in some cases, but might cause segfault in older No - **Type:** `number` - **Default:** `5000` +- **CLI:** `--test-timeout=5000` Default timeout of a test in milliseconds diff --git a/docs/guide/debugging.md b/docs/guide/debugging.md index 1653d09da758..93a835d0c42b 100644 --- a/docs/guide/debugging.md +++ b/docs/guide/debugging.md @@ -4,6 +4,10 @@ title: Debugging | Guide # Debugging +:::tip +When debugging tests you might want to use `--test-timeout` CLI argument to prevent tests from timing out when stopping at breakpoints. +::: + ## VSCode Quick way to debug tests in VSCode is via `JavaScript Debug Terminal`. Open a new `JavaScript Debug Terminal` and run `npm run test` or `vitest` directly. *this works with any code ran in Node, so will work with most JS testing frameworks* diff --git a/packages/vitest/src/node/cli.ts b/packages/vitest/src/node/cli.ts index f75f2d47d29b..d0afc779192a 100644 --- a/packages/vitest/src/node/cli.ts +++ b/packages/vitest/src/node/cli.ts @@ -48,6 +48,7 @@ cli .option('--no-color', 'Removes colors from the console output') .option('--inspect', 'Enable Node.js inspector') .option('--inspect-brk', 'Enable Node.js inspector with break') + .option('--test-timeout