Skip to content

Commit 2ffbb9c

Browse files
Perform dirSync inside beforeEach block
1 parent 8bce7b5 commit 2ffbb9c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

extensions/ql-vscode/test/vscode-tests/no-workspace/query-history/query-history-scrubber.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
TWO_HOURS_IN_MS,
1414
} from "../../../../src/common/time";
1515
import { mockedObject } from "../../utils/mocking.helpers";
16+
import { DirResult } from "tmp";
1617

1718
const now = Date.now();
1819
// We don't want our times to align exactly with the hour,
@@ -21,12 +22,13 @@ const LESS_THAN_ONE_DAY = ONE_DAY_IN_MS - 1000;
2122

2223
describe("query history scrubber", () => {
2324
let deregister: vscode.Disposable | undefined;
24-
25-
const tmpDir = dirSync({
26-
unsafeCleanup: true,
27-
});
25+
let tmpDir: DirResult;
2826

2927
beforeEach(() => {
28+
tmpDir = dirSync({
29+
unsafeCleanup: true,
30+
});
31+
3032
jest.spyOn(extLogger, "log").mockResolvedValue(undefined);
3133

3234
jest.useFakeTimers({
@@ -40,6 +42,7 @@ describe("query history scrubber", () => {
4042
deregister.dispose();
4143
deregister = undefined;
4244
}
45+
tmpDir.removeCallback();
4346
});
4447

4548
it("should not throw an error when the query directory does not exist", async () => {

0 commit comments

Comments
 (0)