Skip to content

Commit 6a39f4b

Browse files
fix test in linux
1 parent 60900b0 commit 6a39f4b

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/test/runTest.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from 'path';
33

44
import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath, runTests } from '@vscode/test-electron';
55
import { PVSC_EXTENSION_ID_FOR_TESTS } from './constants';
6+
import { getOSType } from '../extension/common/platform';
67

78
async function main() {
89
try {
@@ -13,24 +14,29 @@ async function main() {
1314
// The path to test runner
1415
// Passed to --extensionTestsPath
1516
const extensionTestsPath = path.resolve(__dirname, './unittest/index');
16-
1717
const vscodeExecutablePath = await downloadAndUnzipVSCode('stable');
1818
console.log("vscodeExecutablePath: ", vscodeExecutablePath);
1919
const [cliPath, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
2020
console.log("cliPath: ", cliPath);
2121
console.log("args: ", args);
22-
const exec = path.basename(cliPath);
23-
console.log("Base: ", exec);
24-
25-
console.log("Base 2: ", path.dirname(cliPath));
26-
2722

28-
// Use cp.spawn / cp.exec for custom setup
29-
cp.spawnSync(exec, [...args, '--install-extension', PVSC_EXTENSION_ID_FOR_TESTS], {
30-
cwd: path.dirname(cliPath),
31-
encoding: 'utf-8',
32-
stdio: 'inherit',
33-
});
23+
if (getOSType() == "Windows") {
24+
const exec = path.basename(cliPath);
25+
console.log("Base: ", exec);
26+
console.log("Base 2: ", path.dirname(cliPath));
27+
28+
cp.spawnSync(exec, [...args, '--install-extension', PVSC_EXTENSION_ID_FOR_TESTS], {
29+
cwd: path.dirname(cliPath),
30+
encoding: 'utf-8',
31+
stdio: 'inherit',
32+
});
33+
34+
} else {
35+
cp.spawnSync(cliPath, [...args, '--install-extension', PVSC_EXTENSION_ID_FOR_TESTS], {
36+
encoding: 'utf-8',
37+
stdio: 'inherit',
38+
});
39+
}
3440

3541
// Run the extension test
3642
await runTests({

0 commit comments

Comments
 (0)