Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - feat(lsp): Run tests with file watcher #27762

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

stefnotch
Copy link

This addresses issue denoland/vscode_deno#1132

See linked PR for more context denoland/vscode_deno#1243

This pull request is not ready for merging yet. I opened it so that I can ask questions about my code, and about how to best achieve certain results.

I did my best to implement the following

  • Hooking up the existing error line reporting
  • Hooking up the existing expected vs actual reporting
  • Supporting "watch mode" for tests that are started from the LSP.

I did not yet

  • Use the changed_files of the file watcher
  • Clean out the debug logging
  • Rebase all the commits with good messages

My questions are left as comments in the code.

Also, this is more of a personal struggle: I initially really struggled to locally build Deno, as Deno requires some dependencies that are nontrivial to install on Windows.
The instructions were incomplete #27535 Upon updating them, nathanwhit figured out how to change libuv-sys-lite to no longer require the LLVM dependency, which was very nice.
The CMake dependency for libz-sys is still there, and it still causes me troubles, so I tweaked it (zlib-ng-no-cmake-experimental-community-maintained). My hope is that zlib will eventually get replaced by zlib-rs, which just works.

@CLAassistant
Copy link

CLAassistant commented Jan 21, 2025

CLA assistant check
All committers have signed the CLA.

file_watcher::PrintConfig::new("Test", false),
file_watcher::WatcherRestartMode::Automatic,
self.token.clone(),
move |flags, watcher_communicator, changed_paths| {
Copy link
Author

@stefnotch stefnotch Jan 21, 2025

Choose a reason for hiding this comment

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

I'm not entirely sure which files I should pass to the watcher_communicator, and what to do with the changed_paths. I did look at the other places where the file watcher is used, but there the file patterns are part of the CLI arguments.

Meanwhile here, the list of included files are set through the included and excluded tests. Any pointers would be very appreciated.

let line_number = user_frame.line_number.map(|v| v - 1)? as u32;
let column_number =
user_frame.column_number.map(|v| v - 1).unwrap_or(0) as u32;
Some(TestLocation {
Copy link
Author

Choose a reason for hiding this comment

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

This info lets us show an indicator at the assertEquals() that actually failed.

I couldn't really find a better way of figuring out where in the user code the error happened. Is this really it?

@@ -24,7 +24,7 @@ deno_path_util.workspace = true
deno_semver.workspace = true
deno_unsync = { workspace = true, features = ["tokio"] }
faster-hex.workspace = true
flate2 = { workspace = true, features = ["zlib-ng-compat"] }
flate2 = { workspace = true, features = ["default"] }
Copy link
Author

Choose a reason for hiding this comment

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

This change is one of the changes that I'll get rid of when rebasing and fixing the PR. Currently that's just to not require the CMake dependency when developing locally.

@@ -27,4 +27,4 @@ thiserror.workspace = true
windows-sys.workspace = true

[dev-dependencies]
libuv-sys-lite = "=1.48.2"
libuv-sys-lite = { version = "=1.48.3", features = ["dyn-symbols"] }
Copy link
Author

Choose a reason for hiding this comment

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

This change will hopefully not be needed much longer. Hopefully Deno will update its libuv-sys-lite dependency soon :)

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.

2 participants