Skip to content

Commit 737f332

Browse files
authored
test: clean up temporary user-data-dir on exit
1 parent b485855 commit 737f332

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.vscode-test.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from '@vscode/test-cli';
2-
import { mkdtempSync } from 'node:fs';
2+
import { mkdtempSync, rmSync } from 'node:fs';
33
import { tmpdir } from 'node:os';
44
import { join } from 'node:path';
55

@@ -8,6 +8,11 @@ import { join } from 'node:path';
88
// "IPC handle ... is longer than 103 chars" / EINVAL errors in CI.
99
const userDataDir = mkdtempSync(join(tmpdir(), 'vsct-'));
1010

11+
// Remove the temporary user-data-dir when the test process exits.
12+
process.on('exit', () => {
13+
rmSync(userDataDir, { recursive: true, force: true });
14+
});
15+
1116
export default defineConfig({
1217
version: 'stable',
1318
files: './out/test/extension.test.js',

0 commit comments

Comments
 (0)