vitest-dev/vitest · error · TypeError
Unexpected value "--silent=
Error message
Unexpected value "--silent=${value}". Use "--silent=true ${value}" instead. What it means
The `--silent` option's `transform` accepts only `true|yes|true`, `false|no|false`, or the literal string `passed-only`. Any other value (e.g. `--silent=verbose`, `--silent 1`) is rejected with a `TypeError` that suggests the intended two-flag form `--silent=true <value>`.
Solutions
- Use a boolean: `--silent` / `--silent=true` / `--silent=false`.
- For passed-tests-only output use `--silent=passed-only`.
- If you meant to combine silence with another value, pass them as separate flags: `--silent=true --other=value`.
Example fix
# before vitest run --silent=verbose # after vitest run --silent=true # or vitest run --silent=passed-only
Defensive patterns
Strategy: validation
Validate before calling
const SILENT_OK = new Set(['true', 'yes', 'false', 'no', 'passed-only'])
function normalizeSilent(v: unknown): true | false | 'passed-only' {
const s = String(v ?? '').toLowerCase()
if (s === 'true' || s === 'yes') return true
if (s === 'false' || s === 'no') return false
if (s === 'passed-only') return 'passed-only'
throw new TypeError(`Unsupported --silent value: ${String(v)}`)
} Prevention
- Treat `--silent` as boolean-only, plus the single `passed-only` sentinel.
- Avoid numeric or arbitrary verbosity levels for `--silent`.
- Set silence via config `test.silent` for repeatability.
When it happens
Trigger: Passing `--silent=verbose`, `--silent=only`, `--silent=1`, `--silent 2`, or piping another flag's value into `--silent=`. The value `passed-only` is the sole non-boolean sentinel and is returned as-is.
Common situations: Confusing `--silent` with a verbosity selector; assuming numeric levels like other tools' `--silent=2`; copy-paste from a Jest invocation where `--silent` semantics differ.
Related errors
- Unexpected value for --expect.poll
- Unexpected value for --expect
- Expected a single value for option
- "browser.instances" was set in the config, but the array is…
- --cache.dir is deprecated
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/b05a3ec9cf81a51b.
Report an issue: GitHub.
Appendix: source
Thrown at packages/vitest/src/node/cli/cli-config.ts:135
}
return portOrOptions
},
},
silent: {
description: 'Silent console output from tests. Use `\'passed-only\'` to see logs from failing tests only.',
argument: '[value]',
transform(value) {
if (value === 'true' || value === 'yes' || value === true) {
return true
}
if (value === 'false' || value === 'no' || value === false) {
return false
}
if (value === 'passed-only') {
return value
}
throw new TypeError(`Unexpected value "--silent=${value}". Use "--silent=true ${value}" instead.`)
},
},
hideSkippedTests: {
description: 'Hide logs for skipped tests',
},
reporter: null,
reporters: {
alias: 'reporter',
description: `Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,
argument: '<name>',
subcommands: null, // don't support custom objects
array: true,
},
outputFile: {
argument: '<filename/-s>',
description:
'Write test results to a file when supporter reporter is also specified, use cac\'s dot notation for individual outputs of multiple reporters (example: `--outputFile.tap=./tap.txt`)',
subcommands: null,View on GitHub (pinned to 1fa9837ec2)