简体   繁体   English

如何解决我在安装 vscode 以测试我的扩展程序时遇到的错误?

[英]How to resolve an error which i am getting when installing vscode for testing my extension?

I made a vscode extension from the github template now to test i have to run this command according to the guide我现在从 github 模板中做了一个 vscode 扩展来测试我必须根据指南运行这个命令

node ./node_modules/vscode/bin/test

Which install vscode to test my ext.哪个安装 vscode 来测试我的分机。 But after it installs i get the output as但安装后我得到 output

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

In this i am not sure what shall i do?在这我不确定我该怎么办? My ext code is我的分机代码是

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);
}

EDIT:编辑:

I somehow managed installing the vscode to the ./vscode-test folder.我以某种方式设法将 vscode 安装到./vscode-test文件夹。 Now i wrote a test file some sort like this现在我写了一个类似这样的测试文件

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();

This flile is named as test/index.js now when i run this file everything is fine and vscode opens for testing and at the same speed it gets closed and displaying the console as failed:这个文件现在被命名为test/index.js ,当我运行这个文件时,一切都很好,vscode 打开以进行测试,并且以同样的速度关闭并将控制台显示为失败:

Exit code:   1
Done

Failed

Use the current VSC by using an additional Launch config and write the index.(ts/js) file and your test files .通过使用额外的启动配置来使用当前 VSC,并编写index.(ts/js)文件和您的测试文件

Select this config from the Run/Debug bar and press F5. Select 从运行/调试栏中配置此配置,然后按 F5。

Now there is no need to download VSC.现在无需下载 VSC。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我收到此错误,不知道如何解决 - I am getting this error and don't know how to resolve it 使用 TypeScript 选项安装 Quasar 测试扩展时出现 Tsconfig 错误 - Tsconfig error when installing Quasar testing extension with TypeScript option 我正在尝试使用 jest 在我的代码中执行单元测试但出现错误 - I am trying to perform unit testing in my code using jest but getting error 为什么我的 vscode 在我运行扩展时总是显示构建? - Why my vscode always show building when I run extension? 当我加载 api 请求并且我的反应组件尝试呈现时,我总是收到数据未定义错误 - I am always getting a data is undefined error when I am loading a api request and my react component trys to render 为什么在我的无服务器项目上运行 npm 构建时出现此 UnhandledPromiseRejectionWarning 错误? - Why am I getting this UnhandledPromiseRejectionWarning error when running npm build on my serverless project? 我想编辑我的产品列表时遇到问题,出现此错误无法读取null的属性“ title” - I have an issue when I want to edit my product list and i am getting this error Cannot read property 'title' of null 无法运行我的 nodejs 和 typescript 项目,并且我得到“.ts 作为未知文件扩展名” - Cant run my nodejs and typescript project, and I am getting “.ts as an unknown file extension” 尝试从数据库中获取信息时出现错误 - I am getting an error when trying to get information from the database 编译 Angular 6 项目时出现错误 - I am getting an ERROR when compiling Angular 6 project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM