Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Feature]: Explore possibility to integrate Vite into JestΒ #33

@ahnpnl

Description

@ahnpnl

πŸš€ 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 vite in jest-core should use tsx, 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

Pitch

N/A

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions