diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2024-07-09 14:25:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-09 14:25:50 +0100 |
commit | 0087402094b9622e48787572ffa30a41f6b7f3ab (patch) | |
tree | 652bd892d1f09f7f78959c157207afded0415829 /tests | |
parent | c11e2c74e874af29b6ade13ee4ab51a72853d726 (diff) |
fix(lsp): do sloppy resolution for node-to-node imports in byonm (#24481)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/lsp_tests.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 2111c6f07..d42bff4bd 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -14275,6 +14275,46 @@ fn sloppy_imports_not_enabled() { client.shutdown(); } +// Regression test for https://github.com/denoland/deno/issues/24457. +#[test] +fn lsp_byonm_js_import_resolves_to_dts() { + let context = TestContextBuilder::new() + .use_http_server() + .use_temp_cwd() + .add_npm_env_vars() + .build(); + let temp_dir = context.temp_dir(); + temp_dir.write( + "deno.json", + json!({ + "unstable": ["byonm"], + }) + .to_string(), + ); + temp_dir.write( + "package.json", + json!({ + "dependencies": { + "postcss": "*", + }, + }) + .to_string(), + ); + context.run_npm("install"); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); + let diagnostics = client.did_open(json!({ + "textDocument": { + "uri": temp_dir.uri().join("node_modules/postcss/lib/comment.d.ts").unwrap(), + "languageId": "typescript", + "version": 1, + "text": temp_dir.path().join("node_modules/postcss/lib/comment.d.ts").read_to_string(), + } + })); + assert_eq!(json!(diagnostics.all()), json!([])); + client.shutdown(); +} + #[test] fn decorators_tc39() { let context = TestContextBuilder::new().use_temp_cwd().build(); |