{"record":{"id":"b05a3ec9cf81a51b","repo":"vitest-dev/vitest","slug":"unexpected-value-silent-value-use-silen","errorCode":null,"errorMessage":"Unexpected value \"--silent=${value}\". Use \"--silent=true ${value}\" instead.","messagePattern":"Unexpected value \"--silent=(.+?)\"\\. Use \"--silent=true (.+?)\" instead\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/cli/cli-config.ts","lineNumber":135,"sourceCode":"      }\n      return portOrOptions\n    },\n  },\n  silent: {\n    description: 'Silent console output from tests. Use `\\'passed-only\\'` to see logs from failing tests only.',\n    argument: '[value]',\n    transform(value) {\n      if (value === 'true' || value === 'yes' || value === true) {\n        return true\n      }\n      if (value === 'false' || value === 'no' || value === false) {\n        return false\n      }\n      if (value === 'passed-only') {\n        return value\n      }\n\n      throw new TypeError(`Unexpected value \"--silent=${value}\". Use \"--silent=true ${value}\" instead.`)\n    },\n  },\n  hideSkippedTests: {\n    description: 'Hide logs for skipped tests',\n  },\n  reporter: null,\n  reporters: {\n    alias: 'reporter',\n    description: `Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)`,\n    argument: '<name>',\n    subcommands: null, // don't support custom objects\n    array: true,\n  },\n  outputFile: {\n    argument: '<filename/-s>',\n    description:\n      '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`)',\n    subcommands: null,","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/cli/cli-config.ts#L117-L153","documentation":"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>`.","triggerScenarios":"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.","commonSituations":"Confusing `--silent` with a verbosity selector; assuming numeric levels like other tools' `--silent=2`; copy-paste from a Jest invocation where `--silent` semantics differ.","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`."],"exampleFix":"# before\nvitest run --silent=verbose\n\n# after\nvitest run --silent=true\n# or\nvitest run --silent=passed-only","handlingStrategy":"validation","validationCode":"const SILENT_OK = new Set(['true', 'yes', 'false', 'no', 'passed-only'])\nfunction normalizeSilent(v: unknown): true | false | 'passed-only' {\n  const s = String(v ?? '').toLowerCase()\n  if (s === 'true' || s === 'yes') return true\n  if (s === 'false' || s === 'no') return false\n  if (s === 'passed-only') return 'passed-only'\n  throw new TypeError(`Unsupported --silent value: ${String(v)}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","silent","options","transform"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}