-
I'm trying to write a test case in a NextJS application using Jest. On running the test, below error occurs:
Below is the setup of config in
Below is the test file for
On running the test file, the below error occurs:
Not sure if the regex pattern in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
Mmm could you try with adding this to jest.config.js: module.exports = async (...args) => {
const fn = createJestConfig(customJestConfig);
const res = await fn(...args);
res.transformIgnorePatterns = res.transformIgnorePatterns.map((pattern) => {
if (pattern === '/node_modules/') {
return '/node_modules(?!/next)/';
}
return pattern;
});
return res;
}; |
Beta Was this translation helpful? Give feedback.
-
The below config will resolve the issue in
|
Beta Was this translation helpful? Give feedback.
The below config will resolve the issue in
jest.config.js
:In customJestConfig object, add the following property: