Skip to content

Commit 6ffa2ba

Browse files
fix(next/jest): do not watch .next folder (vercel#32659)
`jest --watch` looks for [changes in dotfiles and folders by default](jestjs/jest#10075), which resulted in the tests being re-run when navigating between pages with `next dev`. Fixes vercel#32650 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
1 parent 8b12b17 commit 6ffa2ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/next/build/jest/jest.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default function nextJest(options: { dir?: string } = {}) {
9595
testPathIgnorePatterns: [
9696
// Don't look for tests in node_modules
9797
'/node_modules/',
98-
// Don't look for tests in the the Next.js build output
98+
// Don't look for tests in the Next.js build output
9999
'/.next/',
100100
// Custom config can append to testPathIgnorePatterns but not modify it
101101
// This is to ensure `.next` and `node_modules` are always excluded
@@ -127,6 +127,11 @@ export default function nextJest(options: { dir?: string } = {}) {
127127
// This is to ensure `node_modules` and .module.css/sass/scss are always excluded
128128
...(resolvedJestConfig.transformIgnorePatterns || []),
129129
],
130+
watchPathIgnorePatterns: [
131+
// Don't re-run tests when the Next.js build output changes
132+
'/.next/',
133+
...(resolvedJestConfig.watchPathIgnorePatterns || []),
134+
],
130135
}
131136
}
132137
}

0 commit comments

Comments
 (0)