Investigating test runners and barrel imports
  • TypeScript 51.3%
  • CSS 28.1%
  • JavaScript 11.7%
  • HTML 5.8%
  • Shell 3.1%
Find a file
2025-02-26 22:14:58 -06:00
public initial commit 2025-02-26 20:32:24 -06:00
scripts feat: add vitest setup 2025-02-26 21:20:13 -06:00
src chore: add documentation 2025-02-26 21:59:44 -06:00
.babelrc initial commit 2025-02-26 20:32:24 -06:00
.gitignore initial commit 2025-02-26 20:32:24 -06:00
eslint.config.js initial commit 2025-02-26 20:32:24 -06:00
index.html initial commit 2025-02-26 20:32:24 -06:00
jest.config.ts initial commit 2025-02-26 20:32:24 -06:00
jest.setup.ts initial commit 2025-02-26 20:32:24 -06:00
LICENSE chore: add license file 2025-02-26 22:14:58 -06:00
package-lock.json feat: add vitest setup 2025-02-26 21:20:13 -06:00
package.json feat: add vitest setup 2025-02-26 21:20:13 -06:00
README.md chore: add documentation 2025-02-26 21:59:44 -06:00
tsconfig.app.json feat: add vitest setup 2025-02-26 21:20:13 -06:00
tsconfig.json initial commit 2025-02-26 20:32:24 -06:00
tsconfig.node.json initial commit 2025-02-26 20:32:24 -06:00
vite.config.ts fix: remove unused vitest maxConcurrency setting 2025-02-26 22:06:09 -06:00
vitest.setup.ts feat: add vitest setup 2025-02-26 21:20:13 -06:00

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