Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haoqunjiang/vite-jest
First-class Vite integration for Jest
https://github.com/haoqunjiang/vite-jest
jest jest-transformer vite vite-test
Last synced: 1 day ago
JSON representation
First-class Vite integration for Jest
- Host: GitHub
- URL: https://github.com/haoqunjiang/vite-jest
- Owner: haoqunjiang
- License: mit
- Created: 2021-03-27T06:21:29.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-07T14:39:49.000Z (about 3 years ago)
- Last Synced: 2025-01-13T04:06:55.406Z (9 days ago)
- Topics: jest, jest-transformer, vite, vite-test
- Language: JavaScript
- Homepage:
- Size: 463 KB
- Stars: 408
- Watchers: 13
- Forks: 50
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# vite-jest
First-class Vite integration for Jest.
Still work-in-progress, here are some working examples:
- [Vue 3 + `type: "module"` in `package.json`](./examples/vue-app-type-module/)
- [Vue 3 + `type: "commonjs"` or no `type` field in `package.json`](./examples/vue-app-type-commonjs/)
- Beware that all source and unit test JavaScript files should be named with the `.mjs` extension in this case.
- [Vue 3 + TypeScript](./examples/vue-app-ts/)
- [React + `type: "module"` in `package.json`](./examples/react-app-type-module/)
- Note that `fastRefresh` option of `@vitejs/plugin-react` must be turned off when `process.env.NODE_ENV === 'test'`
- [React + TypeScript](./examples/react-app-ts/)Usage:
1. Add `preset: 'vite-jest'` to your Jest config.
2. Replace the `jest` CLI with `vite-jest`.See [./packages/vite-jest/README.md](./packages/vite-jest/README.md) for more detailed guidelines and implementation notes.