2

I'm super new in this field and I hope this is not a stupid question. Is it possible to test a VS Code extension without building it using the dev source code?
We are trying to develop a test automation framework of several extensions developed by our organization. The requirement is that we should use only ".vsix" files (which are packaged by the pipeline) for test.
I searched for several tools but they either require source code to build the extension or are not suitable in the case (I will provide detail later)

Mainly tried with 2 options:

  1. vscode-extension-tester: https://github.com/redhat-developer/vscode-extension-tester But this needs to build the extension
  2. code-server: https://github.com/coder/code-server This one allows to install and run extensions in a browser instance of VS Code and turns everything to web GUI testing. However, it doesn't guarantee full identical behaviors between the browser instance and an actual one.
2
  • what did you end up using eventually? I have a similar use case.
    – HRD
    CommentedOct 21, 2023 at 20:14
  • Hey @HRD, I was wrong about my comments on the first method. In fact, it doesn't need the source code. The extension can be installed as a dependency. I will put the solution below so that it has better formatting.
    – NevNein
    CommentedNov 30, 2023 at 14:39

1 Answer 1

1

I was wrong about the first method (using the vscode extension tester). Users can use .vsix artifacts as dependencies.

We can start with using the "helloworld" sample provided: https://github.com/redhat-developer/vscode-extension-tester/tree/main/sample-projects/helloworld-sample

Then modify "package.json", update the lines:

"install-vsix": "extest install-vsix -f {PATH_TO_VSIX} --extensions_dir .test-extensions", "ui-test": "extest setup-tests --extensions_dir .test-extensions && npm run install-vsix && extest run-tests './out/ui-test/*-test.js' --code_settings settings.json --extensions_dir .test-extensions" 

This allows users to work without building the extension. Then, all the work is about how to use the package. For more information, please refer to: https://github.com/redhat-developer/vscode-extension-tester/wiki

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.