Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround a node >=12.5.0 bug that causes the process not to exit after tests have completed and cancerous memory growth #8787

Merged
merged 3 commits into from
Aug 16, 2019
Merged
Changes from 2 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
24 changes: 13 additions & 11 deletions packages/jest-haste-map/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class HasteMap extends EventEmitter {
.then(workerReply, workerError);
}

private async _buildHasteMap(data: {
private _buildHasteMap(data: {
removedFiles: FileData;
changedFiles?: FileData;
hasteMap: InternalHasteMap;
Expand Down Expand Up @@ -687,16 +687,18 @@ class HasteMap extends EventEmitter {
}
}

try {
await Promise.all(promises);
this._cleanup();
hasteMap.map = map;
hasteMap.mocks = mocks;
return hasteMap;
} catch (error) {
this._cleanup();
throw error;
}
return Promise.all(promises).then(
() => {
this._cleanup();
hasteMap.map = map;
hasteMap.mocks = mocks;
return hasteMap;
},
error => {
this._cleanup();
throw error;
},
);
}

private _cleanup() {
Expand Down