Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1792138223000.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
__default__: patch
---

Harness runs use less CPU. Jest now builds its file map in a single process instead of starting a pool of worker processes on every cold start or file change, and it no longer indexes Harness's `.harness` cache or iOS and Android build output (`ios/Pods`, `ios/build`, `android/build`, `android/.gradle`, `android/app/build`, `android/app/.cxx`). Jest also finds files without watchman, which is now faster than querying it; Metro still uses watchman.
18 changes: 18 additions & 0 deletions packages/jest/src/jest-preset.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
export default {
runner: '@react-native-harness/jest',
// Tests run serially on the device, so Jest only uses its workers to build
// the haste map. On a cold cache or after any file change that starts a pool
// of `availableParallelism() - 1` processes, which roughly doubles Jest's
// CPU time without making the run faster.
maxWorkers: 1,
// Build and cache output never contains tests, but it can hold tens of
// thousands of files. Jest checks these patterns before descending into a
// directory, so its crawl skips them entirely. Jest appends a project's own
// patterns to the preset's.
modulePathIgnorePatterns: [
'/\\.harness(/|$)',
'/ios/(Pods|build)(/|$)',
'/android/(build|\\.gradle|app/build|app/\\.cxx)(/|$)',
],
// With the build output skipped, Jest's own crawl is cheaper than querying
// watchman, which costs two CLI process spawns per run and still lists every
// file. Metro keeps using watchman.
watchman: false,
};
Loading