{"record":{"id":"77c629aef62561bc","repo":"vitest-dev/vitest","slug":"unexpected-value-for-expect-poll-value-if-y","errorCode":null,"errorMessage":"Unexpected value for --expect.poll: ${value}. If you need to configure timeout, use --expect.poll.timeout=<timeout>","messagePattern":"Unexpected value for --expect\\.poll: (.+?)\\. If you need to configure timeout, use --expect\\.poll\\.timeout=<timeout>","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/cli/cli-config.ts","lineNumber":815,"sourceCode":"      },\n      poll: {\n        description: 'Default options for `expect.poll()`',\n        argument: '',\n        subcommands: {\n          interval: {\n            description:\n              'Poll interval in milliseconds for `expect.poll()` assertions (default: `50`)',\n            argument: '<interval>',\n          },\n          timeout: {\n            description:\n              'Poll timeout in milliseconds for `expect.poll()` assertions (default: `1000`)',\n            argument: '<timeout>',\n          },\n        },\n        transform(value) {\n          if (typeof value !== 'object') {\n            throw new TypeError(\n              `Unexpected value for --expect.poll: ${value}. If you need to configure timeout, use --expect.poll.timeout=<timeout>`,\n            )\n          }\n          return value\n        },\n      },\n    },\n    transform(value) {\n      if (typeof value !== 'object') {\n        throw new TypeError(\n          `Unexpected value for --expect: ${value}. If you need to configure expect options, use --expect.{name}=<value> syntax`,\n        )\n      }\n      return value\n    },\n  },\n  printConsoleTrace: {\n    description: 'Always print console stack traces',","sourceCodeStart":797,"sourceCodeEnd":833,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/cli/cli-config.ts#L797-L833","documentation":"The `--expect.poll` sub-option only accepts an object form (`--expect.poll.interval=<ms>` and/or `--expect.poll.timeout=<ms>`). Supplying a scalar such as `--expect.poll=50` is rejected with a `TypeError` pointing to the `.timeout=` form, because the poll config is an object with named children, not a single number.","triggerScenarios":"Running `vitest --expect.poll=200`, `--expect.poll true`, or any value where `typeof value !== 'object'` inside the `expect.poll` transform.","commonSituations":"Migrating an `expect.pollInterval`/`expect.pollTimeout` config from a previous version and assuming the CLI mirrors it as a scalar; treating the poll option as a boolean enable flag.","solutions":["Use the named sub-flags: `--expect.poll.interval=50 --expect.poll.timeout=1000`.","If you only need the timeout: `--expect.poll.timeout=2000`.","Prefer setting `expect.pollInterval`/`expect.pollTimeout` in the config file for readability."],"exampleFix":"# before\nvitest run --expect.poll=200\n\n# after\nvitest run --expect.poll.interval=50 --expect.poll.timeout=1000","handlingStrategy":"validation","validationCode":"type PollConfig = { interval?: number; timeout?: number }\nfunction parsePollCli(value: unknown): PollConfig {\n  if (value && typeof value === 'object') return value as PollConfig\n  throw new TypeError('Use --expect.poll.interval=<ms> and/or --expect.poll.timeout=<ms>')\n}","typeGuard":"function isPollConfig(v: unknown): v is PollConfig {\n  return typeof v === 'object' && v !== null\n    && (v as any).interval === undefined || typeof (v as any).interval === 'number'\n    && (v as any).timeout === undefined || typeof (v as any).timeout === 'number'\n}","tryCatchPattern":null,"preventionTips":["Remember `--expect.poll` is an object, not a number or boolean.","Set poll config in the config file (`test.expect.pollInterval`/`pollTimeout`) for clarity.","Use dotted CLI keys for nested options generally."],"tags":["cli","expect","poll","options","transform"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}