Skip to content

Commit db361b2

Browse files
install python for tests
1 parent 8933ef8 commit db361b2

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/test/runTest.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import * as cp from 'child_process';
12
import * as path from 'path';
23

3-
import { runTests } from '@vscode/test-electron';
4+
import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath, runTests } from '@vscode/test-electron';
5+
import { PVSC_EXTENSION_ID_FOR_TESTS } from './constants';
46

57
async function main() {
68
try {
@@ -12,8 +14,22 @@ async function main() {
1214
// Passed to --extensionTestsPath
1315
const extensionTestsPath = path.resolve(__dirname, './unittest/index');
1416

15-
// Download VS Code, unzip it and run the integration test
16-
await runTests({ extensionDevelopmentPath, extensionTestsPath });
17+
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable');
18+
const [cliPath, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
19+
20+
// Use cp.spawn / cp.exec for custom setup
21+
cp.spawnSync(cliPath, [...args, '--install-extension', PVSC_EXTENSION_ID_FOR_TESTS], {
22+
encoding: 'utf-8',
23+
stdio: 'inherit',
24+
});
25+
26+
// Run the extension test
27+
await runTests({
28+
// Use the specified `code` executable
29+
vscodeExecutablePath,
30+
extensionDevelopmentPath,
31+
extensionTestsPath,
32+
});
1733
} catch (err) {
1834
console.error('Failed to run tests');
1935
process.exit(1);

0 commit comments

Comments
 (0)