question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`test` field gives a TS error in Vite 3

See original GitHub issue

Describe 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:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
sheremet-vacommented, Jun 24, 2022

Vite 3 is not supported at the moment. We have Vite 2 pinned in package.json.

2reactions
sheremet-vacommented, Jun 28, 2022

Vite 3 is now supported.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found