]> git.lizzy.rs Git - rust.git/commitdiff
Disable file watching when running slow tests
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 24 Jun 2020 10:27:13 +0000 (12:27 +0200)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 24 Jun 2020 10:27:13 +0000 (12:27 +0200)
This should rid us of the intermittent test failure

https://github.com/rust-analyzer/rust-analyzer/pull/5017#issuecomment-648717983

crates/rust-analyzer/tests/heavy_tests/support.rs

index 001a2a1045149eac33a5f93534faf446bce4a9e3..8d88f992dd2c0a278b41f003cee1c973403efd18 100644 (file)
@@ -19,7 +19,7 @@
 
 use ra_project_model::ProjectManifest;
 use rust_analyzer::{
-    config::{ClientCapsConfig, Config, LinkedProject},
+    config::{ClientCapsConfig, Config, FilesConfig, FilesWatcher, LinkedProject},
     main_loop,
 };
 
@@ -90,9 +90,9 @@ pub fn server(self) -> Server {
             },
             with_sysroot: self.with_sysroot,
             linked_projects,
+            files: FilesConfig { watcher: FilesWatcher::Client, exclude: Vec::new() },
             ..Config::default()
         };
-
         if let Some(f) = &self.config {
             f(&mut config)
         }
@@ -173,8 +173,14 @@ fn send_request_(&self, r: Request) -> Value {
         self.client.sender.send(r.into()).unwrap();
         while let Some(msg) = self.recv() {
             match msg {
-                Message::Request(req) if req.method == "window/workDoneProgress/create" => (),
-                Message::Request(req) => panic!("unexpected request: {:?}", req),
+                Message::Request(req) => {
+                    if req.method != "window/workDoneProgress/create"
+                        && !(req.method == "client/registerCapability"
+                            && req.params.to_string().contains("workspace/didChangeWatchedFiles"))
+                    {
+                        panic!("unexpected request: {:?}", req)
+                    }
+                }
                 Message::Notification(_) => (),
                 Message::Response(res) => {
                     assert_eq!(res.id, id);