Open
Description
openedon May 24, 2024
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.84.0
- OS Version: Windows 11
Steps to Reproduce:
- Execute code similar to the one exhibited at https://code.visualstudio.com/api/working-with-extensions/testing-extension#custom-setup-with-vscodetestelectron:
async function main() {
try {
const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
const extensionTestsPath = path.resolve(__dirname, './suite/index');
const vscodeExecutablePath = await downloadAndUnzipVSCode('1.40.1');
const [cliPath, ...args] = resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath);
// Use cp.spawn / cp.exec for custom setup
cp.spawnSync(
cliPath,
[...args, '--install-extension', '<EXTENSION-ID-OR-PATH-TO-VSIX>'],
{
encoding: 'utf-8',
stdio: 'inherit'
// --- BUG: MISSING shell: true option here
}
);
// Run the extension test
await runTests({
// Use the specified `code` executable
vscodeExecutablePath,
extensionDevelopmentPath,
extensionTestsPath
});
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
}
The problem is that on Windows, the cli
evaluates to %vscodeTestDir%\bin\Code
that is not a Windows executable, but a bash shell script, so direct invocation using spanwSync
fails. There must be shell: true
option for the spawnSync
that launches the command using windows command shell, that properly recognizes presence of Code.cmd
and uses that.
Please correct the example in the extension development guide.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels