-
I'm trying to introduce introduce component testing into my app with Cypress. However, Cypress requires a vite config, which Hydrogen of course abstracts. I played with introducing my own vite.config) but kept experiencing various errors with [ESM] (https://vitejs.dev/guide/troubleshooting.htm|#this-package-is-esm-only) or invalid configFile. Cypress seems to suggest configuring global ESM type in package json. Would a custom vite config be the recommended approach? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hydrogen generated template does allow you to have your own vite config. Example: https://github.com/Shopify/hydrogen/blob/main/templates/skeleton/vite.config.ts If you need details of what vite configs that Hydrogen auto injects, see here https://github.com/Shopify/hydrogen/blob/main/packages/hydrogen/src/vite/plugin.ts#L54-L79 |
Beta Was this translation helpful? Give feedback.
-
Component testing is proving a little trickier than I thought with remix but exposing the vite config is done and the rest of the work is out of scope of this issue. Working with a combination of createRemixStub (for page routes) and createMemoryRouter for non-route components. Cypress seems nascent in its support for mocking hooks for example. |
Beta Was this translation helpful? Give feedback.
The key here was to do
h2 setup vite
. Once I started fresh and did that it was mostly a breeze.