现在,我从github模板中创建了一个vscode扩展来测试,我必须按照指南运行这个命令
node ./node_modules/vscode/bin/test安装vscode来测试我的ext。但是在它安装之后,我得到了输出
Downloading VS Code 1.54.3 into .vscode-test/vscode-1.54.3.
Downloading VS Code from: https://update.code.visualstudio.com/1.54.3/win32-archive/stable
Downloaded VS Code 1.54.3
Test error: Error: spawn E:\NewProj\glitter-ext\.vscode-test\vscode-1.54.3\Code.exe ENOENT
Exit code: -4058
Done
Failed在这件事上,我不知道该怎么办?我的分机代码是
import * as vscode from 'vscode';
export function activate(context: vscode.ExtensionContext) {
console.log('Congratulations, your extension "hello-world-vscode-extension" is now active!');
let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
vscode.window.showInformationMessage('Hello World!');
});
context.subscriptions.push(disposable);
}编辑:
我设法将vscode安装到./vscode-test文件夹中。现在我写了一个类似这样的测试文件
const { runTests } = require('vscode-test');
const path = require('path');
async function test() {
try{
await runTests({
extensionPath: path.join(__dirname, "../dist/"),
testRunnerPath: path.join(__dirname, "../.vscode-test/"),
extensionDevelopmentPath: path.join(__dirname, "../dist/")
})
}catch(e){
console.error(e);
}
}
test();当我运行这个文件时,这个文件名为test/index.js,一切都很好,vscode将打开进行测试,并且以相同的速度关闭它,并以失败的方式显示控制台:
Exit code: 1
Done
Failedhttps://stackoverflow.com/questions/66763156
复制相似问题