Skip to content

Commit c8de5c8

Browse files
committed
Try waiting a few seconds before renaming
1 parent 3497219 commit c8de5c8

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

extensions/ql-vscode/test/vscode-tests/cli-integration/jest.setup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { DB_URL, dbLoc, testprojLoc } from "../global.helper";
1111
import fetch from "node-fetch";
1212
import { renameSync } from "fs";
1313
import { unzipToDirectoryConcurrently } from "../../../src/common/unzip-concurrently";
14+
import { platform } from "os";
15+
import { wait } from "./utils";
1416

1517
beforeAll(async () => {
1618
// ensure the test database is downloaded
@@ -37,6 +39,11 @@ beforeAll(async () => {
3739
if (!existsSync(testprojLoc)) {
3840
console.log(`Unzipping test database to ${testprojLoc}`);
3941
await unzipToDirectoryConcurrently(dbLoc, dbParentDir);
42+
// On Windows, wait a few seconds to make sure all background processes
43+
// release their lock on the files before renaming the directory.
44+
if (platform() === "win32") {
45+
await wait(3000);
46+
}
4047
renameSync(join(dbParentDir, "db"), testprojLoc);
4148
console.log("Unzip completed.");
4249
}

extensions/ql-vscode/test/vscode-tests/cli-integration/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ import { join } from "path";
77
export function getDataFolderFilePath(path: string): string {
88
return join(workspace.workspaceFolders![0].uri.fsPath, path);
99
}
10+
11+
export async function wait(ms = 1000) {
12+
return new Promise((resolve) => setTimeout(resolve, ms));
13+
}

0 commit comments

Comments
 (0)