Investigating test runners and barrel imports
- TypeScript 51.3%
- CSS 28.1%
- JavaScript 11.7%
- HTML 5.8%
- Shell 3.1%
| public | ||
| scripts | ||
| src | ||
| .babelrc | ||
| .gitignore | ||
| eslint.config.js | ||
| index.html | ||
| jest.config.ts | ||
| jest.setup.ts | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
| vitest.setup.ts | ||
Barrel
The purpose of this project is to compare Jest and Vitest performance when running a large number of files that include (or not) barrel imports. This is achieved by creating a large number of identical tests for a single, simple component.
The component is in ./src/components/Counter.tsx. It has two antd import
statements. One is a barrel import, and the other loads one of its components
directly. Toggle between these import statements to observe test performance
differences.
To create the test files, run ./scripts/copy-test-files.
To run the tests with Jest run npm run jest and with Vitest run
npm run vitest.
Results
| Runner | Barrel | Non-Barrel |
|---|---|---|
| Jest | 53s | 19s |
| Vitest | 11s | 10s |