From e5dccba3ff4c545ce0375f005dfbe89b73daa36d Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 3 Jul 2023 10:14:10 +0200 Subject: [PATCH] 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 --- tests/support/globalSetup.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/support/globalSetup.ts b/tests/support/globalSetup.ts index 893ec3f8a..b9dda2da4 100644 --- a/tests/support/globalSetup.ts +++ b/tests/support/globalSetup.ts @@ -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 { } else { await startPalmHttpd(); } + + return () => killAllProcesses(); } // Assert that the `rad` CLI is installed and has the correct version.