coopdigital / coop-frontend

Co-op CSS Foundations and design system mono-repo
MIT License
0 stars 0 forks source link

feat: enable test runners in workbench dir #490

Closed omidantilong closed 2 years ago

omidantilong commented 2 years ago

This enables localised testing in the workbench repo using the recommended next settings for babel to keep jest happy. Note that adding a babel.config.js switches the compiler from SWC See notes in workbench/babel.config.js

omidantilong commented 2 years ago

Looks like we can add some config to jest.config.js to tell it to use next/babel, while keeping swc compilation the build stage. https://github.com/vercel/next.js/issues/30811#issuecomment-963102661

Will give it a whirl tomorrow

omidantilong commented 2 years ago

This is tested and working. We get the benefits of using SWC for compilation while still transforming modules correctly for jest. Also updated the babel transform regex to be a bit more human friendly.