summaryrefslogtreecommitdiff
path: root/tests/integration/lsp_tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r--tests/integration/lsp_tests.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs
index 862de41f6..5ec3117e6 100644
--- a/tests/integration/lsp_tests.rs
+++ b/tests/integration/lsp_tests.rs
@@ -12253,3 +12253,40 @@ C.test();
client.shutdown();
}
+
+#[test]
+fn lsp_uses_lockfile_for_npm_initialization() {
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
+ let temp_dir = context.temp_dir();
+ temp_dir.write("deno.json", "{}");
+ // use two npm packages here
+ temp_dir.write("main.ts", "import 'npm:@denotest/esm-basic'; import 'npm:@denotest/cjs-default-export';");
+ context
+ .new_command()
+ .args("run main.ts")
+ .run()
+ .skip_output_check();
+ // remove one of the npm packages and let the other one be found via the lockfile
+ temp_dir.write("main.ts", "import 'npm:@denotest/esm-basic';");
+ assert!(temp_dir.path().join("deno.lock").exists());
+ let mut client = context
+ .new_lsp_command()
+ .capture_stderr()
+ .log_debug()
+ .build();
+ client.initialize_default();
+ let mut skipping_count = 0;
+ client.wait_until_stderr_line(|line| {
+ if line.contains("Skipping pending npm resolution.") {
+ skipping_count += 1;
+ }
+ assert!(
+ !line.contains("Running pending npm resolution."),
+ "Line: {}",
+ line
+ );
+ line.contains("Server ready.")
+ });
+ assert_eq!(skipping_count, 1);
+ client.shutdown();
+}