Menu

Even a mechanical migration deserves a spec
📰

Even a mechanical migration deserves a spec

#devcommunity#dev#jest#migration#tests
Reading 0:00
15s threshold

Swapping Jest for Vitest is a mechanical migration. I still wrote a spec before touching a single test.

The reason was simple: the design system already ran on Vite (Storybook included), and Jest with ts-jest kept a second transform pipeline alive just for tests. Consolidate, and get faster.

The spec had three parts.

Inventory. 68 test files. jest.fn in about 120 places across 30 files. jest.mock in 15. Fake timers in exactly one file. toBeInTheDocument used 219 times. I knew exactly what would break.

Non-goals. No migrating legacy packages that have no tests. No root-level Vitest config until a second package gets tests. No swapping jsdom for happy-dom. And no behavior changes in the tests, only jest.* becoming vi.*.

Definition of done.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.