mirror of
https://github.com/denoland/deno.git
synced 2025-01-19 04:16:00 -05:00
fix(lsp): delete test modules with all tests deleted (#20321)
Fixes https://github.com/denoland/vscode_deno/issues/899.
This commit is contained in:
parent
7e14fe4c02
commit
cd460bbf7e
2 changed files with 31 additions and 0 deletions
|
@ -109,6 +109,7 @@ impl TestServer {
|
|||
if let Some(Ok(parsed_source)) =
|
||||
document.maybe_parsed_source()
|
||||
{
|
||||
let old_tds = tests.remove(specifier).unwrap_or_default();
|
||||
let mut collector = TestCollector::new(
|
||||
specifier.clone(),
|
||||
parsed_source.text_info().clone(),
|
||||
|
@ -127,6 +128,10 @@ impl TestServer {
|
|||
parsed_source.text_info(),
|
||||
),
|
||||
);
|
||||
} else if !old_tds.is_empty() {
|
||||
client.send_test_notification(as_delete_notification(
|
||||
specifier.clone(),
|
||||
));
|
||||
}
|
||||
tests.insert(specifier.clone(), test_definitions);
|
||||
}
|
||||
|
|
|
@ -8549,6 +8549,32 @@ Deno.test({
|
|||
_ => panic!("unexpected message {}", json!(notification)),
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/denoland/vscode_deno/issues/899.
|
||||
temp_dir.write("./test.ts", "");
|
||||
client.write_notification(
|
||||
"textDocument/didChange",
|
||||
json!({
|
||||
"textDocument": {
|
||||
"uri": temp_dir.uri().join("test.ts").unwrap(),
|
||||
"version": 2
|
||||
},
|
||||
"contentChanges": [{ "text": "" }],
|
||||
}),
|
||||
);
|
||||
|
||||
assert_eq!(client.read_diagnostics().all().len(), 0);
|
||||
|
||||
let (method, notification) = client.read_notification::<Value>();
|
||||
assert_eq!(method, "deno/testModuleDelete");
|
||||
assert_eq!(
|
||||
notification,
|
||||
Some(json!({
|
||||
"textDocument": {
|
||||
"uri": temp_dir.uri().join("test.ts").unwrap()
|
||||
}
|
||||
}))
|
||||
);
|
||||
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue