Skip to content

Commit 10f5e47

Browse files
committed
Use temporary shorter path for vscode user data dir
1 parent 13ddb07 commit 10f5e47

File tree

3 files changed

+88
-2
lines changed

3 files changed

+88
-2
lines changed

vscode-testextension/package-lock.json

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-testextension/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"glob": "^10.3.10",
5656
"mocha": "^10.2.0",
5757
"source-map-support": "^0.5.21",
58+
"tmp-promise": "^3.0.3",
5859
"typescript": "^5.2.2"
5960
},
6061
"dependencies": {

vscode-testextension/test/runTest.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from 'path';
2+
import * as tmp from 'tmp-promise';
23

34
import { runTests } from '@vscode/test-electron';
45

@@ -12,10 +13,25 @@ async function main() {
1213
// Passed to --extensionTestsPath
1314
const extensionTestsPath = path.resolve(__dirname, './suite/index');
1415

15-
// Download VS Code, unzip it and run the integration test
16-
await runTests({ extensionDevelopmentPath, extensionTestsPath });
16+
// The path to the user data directory used by vscode
17+
// As the default one is too long (> 103 characters) on some CI setups, forcing it to a temporary and hopefully shorter one.
18+
const userDataDir = await tmp.dir({ unsafeCleanup: true });
19+
20+
try {
21+
// Download VS Code, unzip it and run the integration test
22+
await runTests({
23+
extensionDevelopmentPath,
24+
extensionTestsPath,
25+
launchArgs: ["--user-data-dir", userDataDir.path]
26+
});
27+
}
28+
finally
29+
{
30+
await userDataDir.cleanup();
31+
}
1732
} catch (err) {
1833
console.error('Failed to run tests');
34+
console.error(err);
1935
process.exit(1);
2036
}
2137
}

0 commit comments

Comments
 (0)