bun icon indicating copy to clipboard operation
bun copied to clipboard

feat(vscode-extension): test support

Open samuelgja opened this issue 6 months ago • 1 comments

What does this PR do?

Bun Vscode extension test support It is a little bit inspired by rust vs code extension, where the user can run tests directly in the editor.

I created this functionality a few weeks ago and found it helpful in my projects, so maybe it can be added to the extension, or maybe not :D

  • ability to run test directly from vscode opened editor: Screenshot 2024-09-01 at 12 38 56

  • run test for whole file via vscode settings command: Screenshot 2024-09-01 at 12 41 04

  • user defined test file pattern matcher: Screenshot 2024-09-01 at 12 41 35

  • [x] Documentation or TypeScript types (it's okay to leave the rest blank in this case)

  • [x] Code changes

Code changes

  • added new test provider packages/bun-vscode/src/features/tests/index.ts - handling run (watch) test command + code lens
  • code-lens - add run test watch test buttons for each test in currently opened file
  • update vscode extension package.json to support run test and watch test for the current open file
  • update vscode extension package.json to support new bun.test.filePattern extension setting (pattern for matching the test files)

How did you verify your code works?

Unfortunately, there is no test method in bun vs-code extension code base. So just manually :(

samuelgja avatar Sep 01 '24 11:09 samuelgja