`test` field gives a TS error in Vite 3
See original GitHub issueDescribe the bug
When using with TypeScript upgrading to Vite 3 beta suddenly gives a TypeError for the test
field in the vite.config.ts
file. Namely that Argument of type '{ test: {}; }' is not assignable to parameter of type 'UserConfigExport'.
The vitest types are referenced with the triple slash command and it all work using Vite 2.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-9wpbx8?file=vite.config.ts
System Info
System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Memory: 94.69 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v16.14.2/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Browsers:
Brave Browser: 102.1.39.122
Firefox: 101.0.1
Safari: 15.4
npmPackages:
@vitejs/plugin-vue: ^2.3.3 => 2.3.3
vite: 3.0.0-beta.1 => 3.0.0-beta.1
vitest: ^0.14.2 => 0.14.2
### Used Package Manager
pnpm
### 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.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
`test` field gives a TS error in Vite 3 · vitest-dev/vitest@edbf907 ...
A Vite-native test framework. It's fast! Contribute to vitest-dev/vitest development ... `test` field gives a TS error in Vite 3 #2792. Sign in...
Read more >Troubleshooting - Vite
Syntax Error / Type Error happens # ... Vite cannot handle and does not support code that only runs on non-strict mode (sloppy...
Read more >$setup.t is not a function (Vite, Vue 3, TypeScript, vue-i18n ...
I'm trying to unit test a simple component that uses translations with the vue-i18n module. Here are the files used: src/i18n/index.ts.
Read more >Configuring Vitest
If you want to have a different configuration for testing or your main app doesn't rely on Vite specifically, you could either: Create...
Read more >API - esbuild
The sideEffects field is particularly error-prone for developers because by default it causes all files in your package to be considered dead code...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Vite 3 is not supported at the moment. We have Vite 2 pinned in package.json.
Vite 3 is now supported.