backend-test-utils: stop all running test instances concurrently
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -138,13 +138,15 @@ function registerTestHooks() {
|
||||
registered = true;
|
||||
|
||||
afterAll(async () => {
|
||||
for (const backend of backendInstancesToCleanUp) {
|
||||
try {
|
||||
await backend.stop();
|
||||
} catch (error) {
|
||||
console.error(`Failed to stop backend after tests, ${error}`);
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
backendInstancesToCleanUp.map(async backend => {
|
||||
try {
|
||||
await backend.stop();
|
||||
} catch (error) {
|
||||
console.error(`Failed to stop backend after tests, ${error}`);
|
||||
}
|
||||
}),
|
||||
);
|
||||
backendInstancesToCleanUp.length = 0;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user