Skip to content

Commit ea58362

Browse files
committed
Allow Jest to run tests in node_modules
Resolves jestjs#2145 and jestjs#11781. Prevent haste map from automatically discarding node_modules files. By default, node_modules is still excluded via the testPathIgnorePatterns option. However, users can now use that option to allow node_modules without hacks.
1 parent 7d4595e commit ea58362

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- `[jest-haste-map]` Don't use partial results if file crawl errors ([#12420](https://github.com/facebook/jest/pull/12420))
2828
- `[jest-jasmine2, jest-types]` [**BREAKING**] Move all `jasmine` specific types from `@jest/types` to its own package ([#12125](https://github.com/facebook/jest/pull/12125))
2929
- `[jest-matcher-utils]` Pass maxWidth to `pretty-format` to avoid printing every element in arrays by default ([#12402](https://github.com/facebook/jest/pull/12402))
30+
- `[jest-runtime]` Permit tests in node_modules ([#12438](https://github.com/facebook/jest/pull/12438))
3031

3132
### Chore & Maintenance
3233

packages/jest-runtime/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ export default class Runtime {
386386
name: config.name,
387387
platforms: config.haste.platforms || ['ios', 'android'],
388388
resetCache: options?.resetCache,
389-
retainAllFiles: false,
389+
retainAllFiles: true,
390390
rootDir: config.rootDir,
391391
roots: config.roots,
392392
throwOnModuleCollision: config.haste.throwOnModuleCollision,

0 commit comments

Comments
 (0)