Skip to content

Commit 3192e44

Browse files
cklinCopilot
andcommitted
Fix flaky Windows tests: dispose file watchers before removing tmp dirs
The afterEach cleanup in three discovery test files called tmpDirRemoveCallback() before discovery.dispose(). On Windows, the file system watchers held open handles on the temp directory, causing rimrafSync to fail with ENOTEMPTY. Swapping the order ensures watchers are released before the directory is deleted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bf5f763 commit 3192e44

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

extensions/ql-vscode/test/vscode-tests/minimal-workspace/common/vscode/file-path-discovery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ describe("FilePathDiscovery", () => {
118118
});
119119

120120
afterEach(() => {
121-
tmpDirRemoveCallback?.();
122121
discovery.dispose();
122+
tmpDirRemoveCallback?.();
123123
});
124124

125125
describe("initialRefresh", () => {

extensions/ql-vscode/test/vscode-tests/minimal-workspace/queries-panel/query-discovery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe("Query pack discovery", () => {
5353
});
5454

5555
afterEach(() => {
56-
tmpDirRemoveCallback?.();
5756
discovery.dispose();
57+
tmpDirRemoveCallback?.();
5858
});
5959

6060
describe("buildQueryTree", () => {

extensions/ql-vscode/test/vscode-tests/minimal-workspace/queries-panel/query-pack-discovery.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ describe("Query pack discovery", () => {
3434
});
3535

3636
afterEach(() => {
37-
tmpDirRemoveCallback?.();
3837
discovery.dispose();
38+
tmpDirRemoveCallback?.();
3939
});
4040

4141
describe("findQueryPack", () => {

0 commit comments

Comments
 (0)