0

I made a vscode extension from the github template now to test i have to run this command according to the guide

node ./node_modules/vscode/bin/test

Which install vscode to test my ext. But after it installs i get the output as

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. 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:

Exit code:   1
Done

Failed
1
  • in which directory have you installed vsc: ./vscode-test or ../.vscode-test/ watch the . Commented Mar 24, 2021 at 6:11

1 Answer 1

0

Use the current VSC by using an additional Launch config and write the index.(ts/js) file and your test files.

Select this config from the Run/Debug bar and press F5.

Now there is no need to download VSC.

Sign up to request clarification or add additional context in comments.

1 Comment

Well i need to update it as now i downloaded the vsc manually.to the .vscode-test/ folder but now there is a new error forming when i test the code. Everything is fine but as visual code opens for testing it gets closed at the same time. No errors but the console says Failed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.