From e78c0394104865024e9610855ec0bfcac62e83ce Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 6 Jun 2023 15:37:05 -0700 Subject: [PATCH] Add ignores to fix jest-haste failures (#50875) 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 --- jest.config.js | 1 + run-tests.js | 11 +---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/jest.config.js b/jest.config.js index 42a0d65ba1c5e..0fad2db670024 100644 --- a/jest.config.js +++ b/jest.config.js @@ -14,6 +14,7 @@ const customJestConfig = { '/../packages/next/src/', '/../packages/font/src/', ], + modulePathIgnorePatterns: ['/\\.next/'], modulePaths: ['/lib'], transformIgnorePatterns: ['/next[/\\\\]dist/', '/\\.next/'], globals: { diff --git a/run-tests.js b/run-tests.js index 06cd05dda04ca..aa37f60f3ddc5 100644 --- a/run-tests.js +++ b/run-tests.js @@ -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))