A Jest transformer for seamless Vite integration in testing, version 0.1.4. Provides Vite's transform pipeline for Jest, allowing use of Vite plugins and TypeScript without separate config. Lightweight alternative to ts-jest when using Vite. Active development but experimental.
npm install vite-jestVerified import paths — ran on the pinned version, not inferred.
Shows base Jest config with vite-jest transformer, a simple TypeScript module, and a corresponding test using Vite's transform.
Upgrade to vite-jest@0.1.4, Jest 27, Vite 2.4.2+.
Consider using vitest for production testing.
Use ESM import syntax. If Jest config is in CommonJS, use dynamic import: `module.exports = { transform: { '^.+\.ts$': ['vite-jest', { rootDir: __dirname }] } }`Avoid plugins that require server context in tests, or mock them.
Run `npm install -D vite-jest`
Make vite.config.ts export a sync object or a sync function.
Add `rootDir: __dirname` to the transform options in jest.config.js.