lwc icon indicating copy to clipboard operation
lwc copied to clipboard

Switch from Jest to Vitest

Open nolanlawson opened this issue 4 months ago • 1 comments

Despite the existence of lwc-test and its various @lwc/jest-* packages, this repo itself does not require Jest. So we can switch to another test runner if we want.

...And I kind of want to. After trying to upgrade Prettier to v3 (#4140) and noticing how thoroughly broken ESM support in Jest still is to this day, my wandering eye turns to Vitest. Which I know from experience is pretty dang fast, has decent Jest API compat, and doesn't require any special tooling other than standard Rollup plugins.

It would probably be an effort on our end since we have a lot of tricky jest.config.js files and custom matchers, but it should be doable to switch over. Then we can really make some progress on upgrading Prettier and other dependencies that require ESM.

nolanlawson avatar Apr 15 '24 22:04 nolanlawson

It would probably be an effort on our end since we have a lot of tricky jest.config.js files and custom matchers, but it should be doable to switch over.

If vitest is like the other frameworks and lets you bring your own assertion library, we could do this in parts if we need to. We could do a framework migration first, then a "simple assertions" migration, then custom matchers last.

wjhsf avatar Apr 16 '24 17:04 wjhsf