This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use next/jest to simplify Jest configuration
Next.js has added a wrapper around configuring Jest to run tests. This wrapper will do a lot of things we are already doing in our configuration. The ones we are more paticularly interested in is the auto-mocking of `.css` modules and its variants, as well as mocking image imports. This means we can remove our own file mock and configuration settings. As well as the default test paths that get ignored. In addition, `next/jest` uses `SWC` to transform the files which is a lot faster than Babel and is something we have already implemented in our monorepo iFixit/ifixit@37985f3. Lastly, because of the default settings for Jest that `next/jest` has we needed to manually override the `transformIgnorePatterns` to use an empty array and thus whitelist all node_modules paths. piglovesyou/graphql-let#610 (comment) All the default configurations can be found here: https://github.com/vercel/next.js/blob/canary/packages/next/build/jest/jest.ts#L101C12-L179
- Loading branch information