diff options
Diffstat (limited to 'cli/tests/integration/lsp_tests.rs')
-rw-r--r-- | cli/tests/integration/lsp_tests.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index 5f76d3de2..50b01b2ea 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -8041,6 +8041,49 @@ fn lsp_jupyter_diagnostics() { client.shutdown(); } +#[test] +fn lsp_untitled_file_diagnostics() { + let context = TestContextBuilder::new().use_temp_cwd().build(); + let mut client = context.new_lsp_command().build(); + client.initialize_default(); + let diagnostics = client.did_open(json!({ + "textDocument": { + "uri": "untitled:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "Deno.readTextFileSync(1234);", + }, + })); + assert_eq!( + json!(diagnostics.all_messages()), + json!([ + { + "uri": "untitled:///a/file.ts", + "diagnostics": [ + { + "range": { + "start": { + "line": 0, + "character": 22, + }, + "end": { + "line": 0, + "character": 26, + }, + }, + "severity": 1, + "code": 2345, + "source": "deno-ts", + "message": "Argument of type 'number' is not assignable to parameter of type 'string | URL'.", + }, + ], + "version": 1, + }, + ]) + ); + client.shutdown(); +} + #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PerformanceAverage { |