Shopify / hydrogen-v1

React-based framework for building dynamic, Shopify-powered custom storefronts.
https://shopify.github.io/hydrogen-v1/
MIT License
3.75k stars 327 forks source link

Switch Hydrogen test runner from Jest to Vitest #670

Open jplhomer opened 2 years ago

frehner commented 2 years ago

Adding Vitest for hydrogen-ui, so we're on that from the start. As we migrate components over, we can translate the existing Jest tests to Vitest.

mrkldshv commented 2 years ago

Hey! I see that all tests in hydrogen-ui package have been migrated to vitest. Should we start converting tests in hydrogen package? Are there any prerequisites or blockers?

blittle commented 2 years ago

@mrkldshv I don't think so, just the time and bandwidth to do it.

mrkldshv commented 2 years ago

Right, I see. Can I start working on this?

frehner commented 2 years ago

@mrkldshv Let's hold off for a little bit - there's still some discussion about the future of the hydrogen-ui package that we need to figure out.

I'll respond in this thread with more details once we have made the decision.

Thanks for your enthusiasm! One thing we could try to figure out now / very soon is if we could set it up in a way to slowly migrate the existing tests from Jest to Vitest in-place.

Maybe what we could do is create new Vitest files with a different extension like .vitest.ts and then configure Vitest to only test files with that extension and tell Jest to ignore tests with that extension.

With the goal being that we don't have to do all the tests as once, and instead migrate them over in smaller chunks. Then when it's done we can rename the .vitest.ts -> .test.ts and remove Jest.

Thoughts? Other ideas?

mrkldshv commented 2 years ago

Thanks for reply! I was thinking to start migrating tests gradually, and having separate file extension sounds like a good idea. From what I understand we need to wait for the decision concerning hydrogen-ui package, so I'll be waiting for any updates here.

frehner commented 2 years ago

I'll see if it's useful / possible to setup that situation with Vitest in the existing repo, and if so, we can at least get started there and migrate tests, regardless of the outcome about hydrogen-ui.

mrkldshv commented 2 years ago

That'd be great! Thanks!

frehner commented 2 years ago

To provide an update here, as promised above

Let's hold off for a little bit - there's still some discussion about the future of the hydrogen-ui package that we need to figure out.

I'll respond in this thread with more details once we have made the decision.

We're full-speed ahead on hydrogen-ui now 🙂