-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Describe the bug
Vitest returns strange inline snapshots when using test.each(), which are invalid javascript strings, ie:
import { expect, test } from 'vitest';
test.each([1, 2])('', (input) => {
expect(Math.pow(input, 2)).toMatchInlineSnapshot('1''4')
expect({ num: input }).toMatchInlineSnapshot(`
{
"num": 1,
}
``
{
"num": 2,
}
`)
});Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-1ejwed?file=test/basic.test.ts
System Info
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Pro
Memory: 129.00 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.1/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Browsers:
Chrome: 112.0.5615.137
Chrome Canary: 108.0.5339.0
Safari: 16.2
npmPackages:
@vitejs/plugin-react: ^3.1.0 => 3.1.0
vite: ^4.2.1 => 4.2.1
vitest: ^0.29.7 => 0.29.7
### Used Package Manager
npm
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitest-dev/vitest/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitest.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vitest/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Reactions are currently unavailable
