forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
π Feature Proposal
High level abstraction
Inspired from the work how Angular CLI and Vitest when integrating Vite into their architecture, I think we should be able to do similar thing for Jest
Integrating Vite into Jest architecture is challenging hence we should make a concrete plan of which basic functionalities to roll out gradually to get feedbacks from users.
To make a concrete plan, we need to understand clearly Jest architecture and research deeply into how Angular CLI integrates Vite and how Vitest integrates Vite. This will help us to come up with concrete plan
Potential phase 1 feature roll out
- Enable Vite integration via feature flag in Jest config
// jest.config.ts
import {defineConfig} from 'jest';
import {withViteConfig} from 'jest-config';
export default defineConfig({
future: {
experimental_vite: withViteConfig({
// base Vite options to support
}),
},
});
- Come up with which basic Vite config options Jest can support in phase 1
- Reuse Vite architecture to replace some functionalities in
jest-core - Leverage as much as we can with Vite dev server to replace some functionalities in
jest-core.
Technical requirements
- User must be able to run tests with Jest when enabling Vite integration and see significant improvements on performance
- Loading
viteinjest-coreshould usetsx, e.g.
const {require: tsxRequire} = await import('tsx/cjs/api');
const viteModule = tsxRequire('vite', __dirname);
- The implementation should have concrete e2e tests to showcase the improvements
Motivation
Improve DX
Example
References
- Angular CLI repo https://github.com/angular/angular-cli
- Vitest repo https://github.com/vitest-dev/vitest
- tsx API https://tsx.is/dev-api/tsx-require
- Docusaurus feature flag https://docusaurus.io/blog/releases/3.8#future-flags
- Vite repo https://github.com/vitejs/vite
Pitch
N/A
Copilot
Metadata
Metadata
Assignees
Labels
No labels