Teardown hanging processes in Vitest

After setting up the global env for the httpd:api tests, there were
tests hanging until the timeout of 10 seconds killed them.

By returning an async function from the globalSetup we can kill them
preemptively.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez
2023-07-04 09:56:23 +02:00
parent 82941440b9
commit e5dccba3ff
+4 -1
View File
@@ -14,7 +14,8 @@ import {
startPalmHttpd,
} from "@tests/support/fixtures.js";
import { createPeerManager } from "@tests/support/peerManager.js";
import { heartwoodShortSha, tmpDir } from "./support";
import { heartwoodShortSha, tmpDir } from "@tests/support/support.js";
import { killAllProcesses } from "@tests/support/process.js";
const workspacePaths = [Path.join(tmpDir, "peers"), Path.join(tmpDir, "repos")];
@@ -64,6 +65,8 @@ export default async function globalSetup(_config: FullConfig): Promise<void> {
} else {
await startPalmHttpd();
}
return () => killAllProcesses();
}
// Assert that the `rad` CLI is installed and has the correct version.