mirror of
https://github.com/denoland/deno.git
synced 2024-10-29 08:58:01 -04:00
tests(lsp): fix flakey lsp integration test (#10875)
This commit is contained in:
parent
3a4a47799f
commit
d6f6e157bd
1 changed files with 20 additions and 28 deletions
|
@ -2156,7 +2156,6 @@ fn lsp_diagnostics_deno_types() {
|
|||
shutdown(&mut client);
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn lsp_diagnostics_refresh_dependents() {
|
||||
let mut client = init("initialize_params.json");
|
||||
|
@ -2264,35 +2263,28 @@ fn lsp_diagnostics_refresh_dependents() {
|
|||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
let (method, _) = client.read_notification::<Value>().unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
let (method, _) = client.read_notification::<Value>().unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
let (method, _) = client.read_notification::<Value>().unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
let (method, _) = client.read_notification::<Value>().unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
let (method, maybe_params) = client
|
||||
.read_notification::<lsp::PublishDiagnosticsParams>()
|
||||
// ensure that the server publishes any inflight diagnostics
|
||||
std::thread::sleep(std::time::Duration::from_millis(250));
|
||||
client
|
||||
.write_request::<_, _, Value>("shutdown", json!(null))
|
||||
.unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
assert!(maybe_params.is_some());
|
||||
let params = maybe_params.unwrap();
|
||||
assert!(params.diagnostics.is_empty());
|
||||
let (method, maybe_params) = client
|
||||
.read_notification::<lsp::PublishDiagnosticsParams>()
|
||||
.unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
assert!(maybe_params.is_some());
|
||||
let params = maybe_params.unwrap();
|
||||
assert!(params.diagnostics.is_empty());
|
||||
let (method, maybe_params) = client
|
||||
.read_notification::<lsp::PublishDiagnosticsParams>()
|
||||
.unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
assert!(maybe_params.is_some());
|
||||
let params = maybe_params.unwrap();
|
||||
assert!(params.diagnostics.is_empty());
|
||||
client.write_notification("exit", json!(null)).unwrap();
|
||||
|
||||
shutdown(&mut client);
|
||||
let queue_len = client.queue_len();
|
||||
assert!(!client.queue_is_empty());
|
||||
for i in 0..queue_len {
|
||||
let (method, maybe_params) = client
|
||||
.read_notification::<lsp::PublishDiagnosticsParams>()
|
||||
.unwrap();
|
||||
assert_eq!(method, "textDocument/publishDiagnostics");
|
||||
// the last 3 diagnostic publishes should be the clear of any diagnostics
|
||||
if queue_len - i <= 3 {
|
||||
assert!(maybe_params.is_some());
|
||||
let params = maybe_params.unwrap();
|
||||
assert!(params.diagnostics.is_empty());
|
||||
}
|
||||
}
|
||||
assert!(client.queue_is_empty());
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
|
Loading…
Reference in a new issue