We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am mocking a module:
vi.mock("country-region-data", () => { return { allCountries: ["UK"], UK: "UK", } })
Then, testing it:
// getCountries just imports the module - import("country-region-data") const result = await getCountries() expect(result).toMatchObject({ allCountries: ["UK"], UK: "UK", })
When I run the test, I get the following error:
Error: [vitest] No "Symbol(Symbol.iterator)" export is defined on the "country-region-data" mock. Did you forget to return it from "vi.mock"?
If I spread the object in expect (expect({ ...result })), the test succeeds.
expect
expect({ ...result })
I think it shouldn't expect an iterator in this case.
https://stackblitz.com/edit/node-pnfxmw?file=test%2Fcountries.test.ts,package.json
System: OS: macOS 13.1 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 1.06 GB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.2.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.13.1 - Browsers: Brave Browser: 110.1.48.158 Chrome: 109.0.5414.119 Firefox: 105.0.1 Safari: 16.2 npmPackages: vite: ^4.1.1 => 4.1.1 vitest: ^0.28.4 => 0.28.4
npm
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
I am mocking a module:
Then, testing it:
When I run the test, I get the following error:
If I spread the object in
expect
(expect({ ...result })
), the test succeeds.I think it shouldn't expect an iterator in this case.
Reproduction
https://stackblitz.com/edit/node-pnfxmw?file=test%2Fcountries.test.ts,package.json
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: