diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-09-04 13:22:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 13:22:30 +0100 |
commit | 84dc375b2d28a0ba9ddf0fbc5168505c19b1adea (patch) | |
tree | 5e55570a55da3e5f2261c11bb3b17df49b85e0bb /tests/integration/lsp_tests.rs | |
parent | 0e0a5c24ea8b17d410c30bf3fcb70c749b35f8b3 (diff) |
fix(lsp): update diagnostics on npm install (#25352)
Diffstat (limited to 'tests/integration/lsp_tests.rs')
-rw-r--r-- | tests/integration/lsp_tests.rs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 7c7e9315c..4693b7222 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -14767,7 +14767,6 @@ fn lsp_byonm() { "@denotest/esm-basic": "*", }, })); - context.run_npm("install"); let mut client = context.new_lsp_command().build(); client.initialize_default(); let diagnostics = client.did_open(json!({ @@ -14800,6 +14799,51 @@ fn lsp_byonm() { "source": "deno", "message": "Could not find a matching package for 'npm:chalk' in a package.json file. You must specify this as a package.json dependency when the node_modules folder is not managed by Deno.", }, + { + "range": { + "start": { + "line": 2, + "character": 15, + }, + "end": { + "line": 2, + "character": 36, + }, + }, + "severity": 1, + "code": "resolver-error", + "source": "deno", + "message": "Could not resolve \"@denotest/esm-basic\", but found it in a package.json. Deno expects the node_modules/ directory to be up to date. Did you forget to run `deno install`?", + }, + ]) + ); + context.run_npm("install"); + client.did_change_watched_files(json!({ + "changes": [{ + "uri": temp_dir.url().join("node_modules/.package-lock.json").unwrap(), + "type": 1, + }], + })); + let diagnostics = client.read_diagnostics(); + assert_eq!( + json!(diagnostics.all()), + json!([ + { + "range": { + "start": { + "line": 1, + "character": 15, + }, + "end": { + "line": 1, + "character": 26, + }, + }, + "severity": 1, + "code": "resolver-error", + "source": "deno", + "message": "Could not find a matching package for 'npm:chalk' in a package.json file. You must specify this as a package.json dependency when the node_modules folder is not managed by Deno.", + }, ]) ); client.shutdown(); |