{"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/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/cli/cli-config.ts#L797-L833","documentation":"Thrown by the `--expect.poll` option transform when it receives a non-object value. `--expect.poll` is a container for sub-options (interval, timeout); it must be configured via dotted keys (`--expect.poll.timeout=<ms>`), not assigned a scalar directly.","triggerScenarios":"Passing `--expect.poll=1000` or `--expect.poll=50` (a number/string) instead of `--expect.poll.timeout=1000`. The transform checks `typeof value !== 'object'` and rejects scalars, pointing the user at the dotted syntax.","commonSituations":"Assuming --expect.poll takes a timeout value directly; copy-paste from docs that used the JS object form `{ poll: { timeout: 1000 } }` translated incorrectly to the CLI; shell scripts building the flag from a variable.","solutions":["Use the dotted key: `--expect.poll.timeout=<ms>` and/or `--expect.poll.interval=<ms>`.","If configuring in a file, use the object form `expect: { poll: { timeout: 1000 } }` rather than a scalar."],"exampleFix":"# before\nvitest --expect.poll=1000\n# after\nvitest --expect.poll.timeout=1000","handlingStrategy":"validation","validationCode":"if (typeof poll !== 'object' || poll === null) {\n  throw new Error('expect.poll must be an object; use --expect.poll.timeout=<ms>')\n}","typeGuard":"function isPollOptions(v: unknown): v is { timeout?: number; interval?: number } {\n  return v !== null && typeof v === 'object'\n}","tryCatchPattern":null,"preventionTips":["Configure poll via dotted CLI keys: --expect.poll.timeout, --expect.poll.interval.","In config files use the object form expect: { poll: { timeout: n } }.","Never assign a scalar to --expect.poll."],"tags":[],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}