Skip to content

Run tests with file watcher#1243

Merged
nayeemrmn merged 2 commits intodenoland:mainfrom
stefnotch:feat/continous-run
Feb 22, 2025
Merged

Run tests with file watcher#1243
nayeemrmn merged 2 commits intodenoland:mainfrom
stefnotch:feat/continous-run

Conversation

@stefnotch
Copy link
Contributor

@stefnotch stefnotch commented Jan 21, 2025

I wanted a Deno testing experience that's closer to Vitest's UI or Wallaby.js. As in

  • See the test results inline in the IDE
  • Re-run the tests and update the IDE's UI when saving

This now works 🎉
https://github.com/user-attachments/assets/b283b1e1-528f-47d5-b436-86c546d0d3c7

(The execution speed is very slow, because I have not compiled Deno in release mode)

To do so, I had to

Fix #1132

@CLAassistant
Copy link

CLAassistant commented Jan 21, 2025

CLA assistant check
All committers have signed the CLA.

@stefnotch
Copy link
Contributor Author

Related PR with questions has been opened denoland/deno#27762

],
"engines": {
"vscode": "^1.60.0"
"vscode": "^1.77.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make a difference to the currently resolved version and is it essential? I'd like to avoid it because the TS plugin API communication has been brittle in the past

Copy link
Contributor Author

@stefnotch stefnotch Feb 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this bit is essential. It's what is required to get request.continuous and the final argument in

new vscode.TestRunRequest(
              runData.request.include,
              runData.request.exclude,
              runData.request.profile,
              true,
            ),

Without that, we don't have the typings for the continuous run feature in vscode.

I believe that 1.77.0 is also the minimal version bump to get access to said feature.

Copy link
Collaborator

@nayeemrmn nayeemrmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nayeemrmn nayeemrmn merged commit 50bebcf into denoland:main Feb 22, 2025
1 check passed
@stefnotch
Copy link
Contributor Author

Thank you for merging this!

Would you have any suggestions regarding the Deno LSP PR that implements the internal functionality for this?
denoland/deno#27762

One of my biggest questions was: There's fair bit of code duplication im Deno. The same sort of "run normal" vs "run in watch mode" logic is duplicated here:
run_tests
https://github.com/denoland/deno/blob/57dd66ec3dae2a0fe376f6a43c476dfade421c84/cli/tools/test/mod.rs#L1555
run_tests_with_watch
https://github.com/denoland/deno/blob/57dd66ec3dae2a0fe376f6a43c476dfade421c84/cli/tools/test/mod.rs#L1647

exec
https://github.com/denoland/deno/blob/57dd66ec3dae2a0fe376f6a43c476dfade421c84/cli/lsp/testing/execution.rs#L216

run_benchmarks
https://github.com/denoland/deno/blob/57dd66ec3dae2a0fe376f6a43c476dfade421c84/cli/tools/bench/mod.rs#L426
run_benchmarks_with_watch
https://github.com/denoland/deno/blob/57dd66ec3dae2a0fe376f6a43c476dfade421c84/cli/tools/bench/mod.rs#L492

Now I did just "exec_with_watch" to the LSP and call it a day, but I feel like there might be a better approach. Any recommendations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Watch mode for testing view

3 participants