Skip to content

Commit

Permalink
Add ignores to fix jest-haste failures (vercel#50875)
Browse files Browse the repository at this point in the history
This pops up occasionally depending on order tests are run and `.next` being present and `jest` trying to process modules inside this folder. 

x-ref: https://github.com/vercel/next.js/actions/runs/5193671295/jobs/9364540542?pr=50869
  • Loading branch information
ijjk authored and hydRAnger committed Jun 12, 2023
1 parent d3abccc commit e78c039
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const customJestConfig = {
'<rootDir>/../packages/next/src/',
'<rootDir>/../packages/font/src/',
],
modulePathIgnorePatterns: ['/\\.next/'],
modulePaths: ['<rootDir>/lib'],
transformIgnorePatterns: ['/next[/\\\\]dist/', '/\\.next/'],
globals: {
Expand Down
11 changes: 1 addition & 10 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,16 +458,7 @@ async function main() {
)
break
} catch (err) {
// jest-hast-map can cause a false failure do to
// the .next/package.json generated
const isJestHasteError =
(err.output?.includes('Error: Cannot parse') ||
err.output?.includes(
'Haste module map. It cannot be resolved'
)) &&
err.output?.includes('jest-haste-map')

if (i < numRetries || isJestHasteError) {
if (i < numRetries) {
try {
let testDir = path.dirname(path.join(__dirname, test))

Expand Down

0 comments on commit e78c039

Please sign in to comment.