microsoft / microsoft/vscode-extension-samples

webpack-sample: include extension test example

Open
#363 0 comments 3 reactions 1 assignee View on GitHub

@jrieken is already working on this.

Since Jul 14, 2021.

feature-request
Dominant language
TypeScript
Stars
10.2k
Forks
3.9k
PR merge metrics
No merged PRs in 30d

Description

I have difficulties with setting up extension tests when using webpack.
It looks like there was a test sample before, but now it's gone.

Would be nice if the example contains the best practice / example when webpack is in use.

In particular, I want to learn:

  • How to set up the preLaunchTask for Extension Tests correctly in launch.json: Currently Extension Tests configuration is using "npm: test-compile", that invokes only "tsc -p ./". package.json points to the webpacked "./dist/extension" as the extension main. As a result, when the task starts, it's possible that the test runs the webpacked version built with a stale version of code.

  • How to set breakpoints in the extension code (src/*.ts) when debugging a test using the "Extension Tests" configuration:
    Breakpoints set in the main extension source code (src/*.ts) sometimes never hit. Not sure if that's related to the fact the runTest is loading the webpacked version or whether some javascript optimization gets involved. Example to demonstrate how to make it work correctly is greatly appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.