Skip to content

Commit 9ad0f4b

Browse files
niieaniscotthovestadt
authored andcommitted
Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth (#8787)
1 parent 4df0070 commit 9ad0f4b

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
- `[jest-snapshots]` Fix test retries that contain snapshots ([#8629](https://github.com/facebook/jest/pull/8629))
4040
- `[jest-mock]` Fix incorrect assignments when restoring mocks in instances where they originally didn't exist ([#8631](https://github.com/facebook/jest/pull/8631))
4141
- `[expect]` Fix stack overflow when matching objects with circular references ([#8687](https://github.com/facebook/jest/pull/8687))
42+
- `[jest-haste-map]` Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth ([#8787](https://github.com/facebook/jest/pull/8787))
4243

4344
### Chore & Maintenance
4445

packages/jest-haste-map/src/index.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class HasteMap extends EventEmitter {
642642
.then(workerReply, workerError);
643643
}
644644

645-
private async _buildHasteMap(data: {
645+
private _buildHasteMap(data: {
646646
removedFiles: FileData;
647647
changedFiles?: FileData;
648648
hasteMap: InternalHasteMap;
@@ -687,16 +687,18 @@ class HasteMap extends EventEmitter {
687687
}
688688
}
689689

690-
try {
691-
await Promise.all(promises);
692-
this._cleanup();
693-
hasteMap.map = map;
694-
hasteMap.mocks = mocks;
695-
return hasteMap;
696-
} catch (error) {
697-
this._cleanup();
698-
throw error;
699-
}
690+
return Promise.all(promises).then(
691+
() => {
692+
this._cleanup();
693+
hasteMap.map = map;
694+
hasteMap.mocks = mocks;
695+
return hasteMap;
696+
},
697+
error => {
698+
this._cleanup();
699+
throw error;
700+
},
701+
);
700702
}
701703

702704
private _cleanup() {

0 commit comments

Comments
 (0)