From b25912bc5edfa7ef0a414656aa255ebdc25eab0b Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 3 Apr 2024 12:11:28 +0100 Subject: [PATCH] Correct the lock path. --- globalSetup.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/globalSetup.ts b/globalSetup.ts index cc3ec6bb24..0d0ec25bf8 100644 --- a/globalSetup.ts +++ b/globalSetup.ts @@ -1,13 +1,15 @@ import { GenericContainer, Wait } from "testcontainers" +import path from "path" import lockfile from "proper-lockfile" export default async function setup() { + const lockPath = path.resolve(__dirname, "globalSetup.ts") if (process.env.REUSE_CONTAINERS) { // If you run multiple tests at the same time, it's possible for the CouchDB // shared container to get started multiple times despite having an // identical reuse hash. To avoid that, we do a filesystem-based lock so // that only one globalSetup.ts is running at a time. - lockfile.lockSync("globalSetup.lock") + lockfile.lockSync(lockPath) } try { @@ -45,7 +47,7 @@ export default async function setup() { await couchdb.start() } finally { if (process.env.REUSE_CONTAINERS) { - lockfile.unlockSync("globalSetup.lock") + lockfile.unlockSync(lockPath) } } }