Skip to content

Commit

Permalink
feat(publication): add moduleNameMapper in jest.config.js to mock @fo…
Browse files Browse the repository at this point in the history
…ntsource imports

The moduleNameMapper configuration is added to jest.config.js to mock imports of @fontsource in the publication app. This allows for easier testing by replacing @fontsource imports with a custom module located at fontsourceStub.
  • Loading branch information
ktun95 committed Dec 4, 2024
1 parent d8383f3 commit 92369bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Empty file added apps/publication/fontsourceStub
Empty file.
3 changes: 3 additions & 0 deletions apps/publication/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const customJestConfig = {
"**/components/**/*.{ts,tsx}",
"**/common/hooks/*.{ts,tsx}",
],
moduleNameMapper: {
"@fontsource(.*)": "<rootDir>/fontsourceStub",
},
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
Expand Down

0 comments on commit 92369bf

Please sign in to comment.