Skip to content

vscode: create integration test harness

Warren Gifford requested to merge tjk/vsce-integration into main

Created by: tjkandala

Closes #26453 (closed).

The VS Code extension is currently covered by a smoke test that asserts that the extension compiles and loads in VS Code. In order to increase our confidence in adding new features and making changes to existing features, we need to increase our test coverage. To that end, I've added an integration test harness for the VS Code that should be familiar to our developers due to its similarity to the web and browser test harnesses.

Overview:

  • Request interception: we use Polly.JS to intercept requests to the Sourcegraph GraphQL API and return mock data. We wrote an adapter to use Polly.JS with the Fetch domain of the Chrome DevTools protocol, which allows us to integrate with Puppeteer.
    • VS Code on the desktop will run our extension in a Node.js extension host by default, so we ensure that we use the extension is loaded in a WebWorker (with the --extensionDevelopmentKind=web CLI arg) in order to intercept extension "core" requests (since they're made from the same browser as the webviews we interact with).

TODO:

  • Create issues for current user flows that need to be integration tested.
  • Code coverage instrumentation (separate PR)
  • Huge chunk of time in CI is webpack compilation. Migrate to esbuild (#34010)
  • Ensure the tests only run on client PRs, nightly builds, and release builds
    • Nightly builds (separate PR)
    • Release builds (separate PR in which we implement automated releases)

Test plan

  • Run yarn and yarn generate in repo root.
  • Run yarn build:test in client/vscode.
  • Run yarn test-integration in `client/vscode

https://user-images.githubusercontent.com/37420160/163427816-c8bc56d9-a48a-4771-a5b5-73f74ab81208.mov

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading