vitest-5-0-0-18-b
Claude Code's read-only tools, web search on, ludion sync off
Question
What does vitest --repeats do?
Answer key
- A correct answer says
- The `--repeats` CLI option reruns tests a given number of times.
- The stale answer
- Repeats can only be set per test via the `repeats` test option.
Answer
`vitest --repeats=<n>` runs every test `n` extra times, whether it passes or fails. The default is `0`. If any one of those runs fails, the whole test is marked as failed, so the flag is mainly for finding flaky tests. A test that sets its own `repeats` option (e.g. `test('x', { repeats: 3 }, ...)`) overrides the global value. `--retry` is different: it only re-runs a test after it fails, and the test passes if any attempt succeeds.
I found the flag documented only on the config page for Vitest's main branch, not in the CLI reference. It may be new, so check that your installed version supports it.
Sources:
- [Vitest config: repeats (main.vitest.dev)](https://main.vitest.dev/config/repeats)
- [docs/config/repeats.md mirror](https://next.tangled.org/vitest.dev/vitest/blob/main/docs/config/repeats.md)Grade
correct
The judge's reason: It says the --repeats CLI flag reruns every test a set number of times and treats the per-test repeats option only as an override, not the sole mechanism.
Session log
Tool call: ToolSearch
{ "query": "select:WebSearch", "max_results": 1 }Tool output
{"type":"tool_reference","tool_name":"WebSearch"}Tool call: WebSearch
{ "query": "vitest CLI --repeats option", "mode": "standard" }Tool output
Web search results for query: "vitest CLI --repeats option" Links: [{"title":"main.vitest.dev","url":"https://main.vitest.dev/config/repeats"},{"title":"next.tangled.org","url":"https://next.tangled.org/vitest.dev/vitest/blob/main/docs/config/repeats.md"},{"title":"github.com","url":"https://github.com/vitest-dev/vitest/blob/46dc57156700ebd5d9d99fc4c5e4180614984f27/docs/guide/cli.md"},{"title":"github.com","url":"https://github.com/vitest-dev/vitest/blob/43fa6baa6d10fe4363dc06a1af2da52d5746dd4c/docs/guide/cli.md"},{"title":"github.com","url":"https://github.com/Aslemammad/vitest/blob/5958d75d3c4bb5b2ccfead937ed05657cfb857db/docs/guide/cli.md"},{"title":"Command Line Interface","url":"https://v0.vitest.dev/guide/cli"},{"title":"next.tangled.org","url":"https://next.tangled.org/vitest.dev/vitest/blob/v1/docs/guide/cli.md"},{"title":"next.tangled.org","url":"https://next.tangled.org/vitest.dev/vitest/blob/v0/docs/guide/cli.md"},{"title":"next.tangled.org","url":"https://next.tangled.org/vitest.dev/vitest/blob/v2/docs/guide/cli.md"}] The `--repeats` flag is documented as a config option with a CLI form, `--repeats=<number>`. Per the official config reference (default 0), it runs each test a set number of times regardless of outcome. A test that sets its own repeats option overrides this value. The docs also say that a single failing repetition marks the whole test as failed, which makes the flag useful for checking flaky tests. Verifying that tests are stable across multiple runs is its main use, and any failure on any repetition fails the test. The CLI reference pages I found don't list `--repeats` in their options tables, so the config page is the main source. Search results also included mirror copies of the same docs, which show the same details. REMINDER: You MUST include the sources above in your response to the user using markdown hyperlinks.Agent
`vitest --repeats=<n>` runs every test `n` extra times, whether it passes or fails. The default is `0`. If any one of those runs fails, the whole test is marked as failed, so the flag is mainly for finding flaky tests. A test that sets its own `repeats` option (e.g. `test('x', { repeats: 3 }, ...)`) overrides the global value. `--retry` is different: it only re-runs a test after it fails, and the test passes if any attempt succeeds. I found the flag documented only on the config page for Vitest's main branch, not in the CLI reference. It may be new, so check that your installed version supports it. Sources: - [Vitest config: repeats (main.vitest.dev)](https://main.vitest.dev/config/repeats) - [docs/config/repeats.md mirror](https://next.tangled.org/vitest.dev/vitest/blob/main/docs/config/repeats.md)