diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests_lsp.rs | 24 | ||||
-rw-r--r-- | cli/tests/lsp/initialize_params.json | 1 | ||||
-rw-r--r-- | cli/tests/lsp/initialize_params_bad_config_option.json | 62 |
3 files changed, 87 insertions, 0 deletions
diff --git a/cli/tests/integration_tests_lsp.rs b/cli/tests/integration_tests_lsp.rs index 04c66625c..c33f6721f 100644 --- a/cli/tests/integration_tests_lsp.rs +++ b/cli/tests/integration_tests_lsp.rs @@ -172,6 +172,30 @@ fn lsp_tsconfig_types() { } #[test] +fn lsp_tsconfig_bad_config_path() { + let mut client = init("initialize_params_bad_config_option.json"); + let (method, maybe_params) = client.read_notification().unwrap(); + assert_eq!(method, "window/showMessage"); + assert_eq!(maybe_params, Some(lsp::ShowMessageParams { + typ: lsp::MessageType::Warning, + message: "The path to the configuration file (\"bad_tsconfig.json\") is not resolvable.".to_string() + })); + let diagnostics = did_open( + &mut client, + json!({ + "textDocument": { + "uri": "file:///a/file.ts", + "languageId": "typescript", + "version": 1, + "text": "console.log(Deno.args);\n" + } + }), + ); + let diagnostics = diagnostics.into_iter().flat_map(|x| x.diagnostics); + assert_eq!(diagnostics.count(), 0); +} + +#[test] fn lsp_triple_slash_types() { let mut params: lsp::InitializeParams = serde_json::from_value(load_fixture("initialize_params.json")).unwrap(); diff --git a/cli/tests/lsp/initialize_params.json b/cli/tests/lsp/initialize_params.json index 01b334cd5..f0b2d1dad 100644 --- a/cli/tests/lsp/initialize_params.json +++ b/cli/tests/lsp/initialize_params.json @@ -12,6 +12,7 @@ "references": true, "test": true }, + "config": "", "importMap": null, "lint": true, "suggest": { diff --git a/cli/tests/lsp/initialize_params_bad_config_option.json b/cli/tests/lsp/initialize_params_bad_config_option.json new file mode 100644 index 000000000..fbff31566 --- /dev/null +++ b/cli/tests/lsp/initialize_params_bad_config_option.json @@ -0,0 +1,62 @@ +{ + "processId": 0, + "clientInfo": { + "name": "test-harness", + "version": "1.0.0" + }, + "rootUri": null, + "initializationOptions": { + "enable": true, + "codeLens": { + "implementations": true, + "references": true, + "test": true + }, + "config": "bad_tsconfig.json", + "importMap": null, + "lint": true, + "suggest": { + "autoImports": true, + "completeFunctionCalls": false, + "names": true, + "paths": true, + "imports": { + "hosts": {} + } + }, + "unstable": false + }, + "capabilities": { + "textDocument": { + "codeAction": { + "codeActionLiteralSupport": { + "codeActionKind": { + "valueSet": [ + "quickfix" + ] + } + }, + "isPreferredSupport": true, + "dataSupport": true, + "resolveSupport": { + "properties": [ + "edit" + ] + } + }, + "foldingRange": { + "lineFoldingOnly": true + }, + "synchronization": { + "dynamicRegistration": true, + "willSave": true, + "willSaveWaitUntil": true, + "didSave": true + } + }, + "workspace": { + "configuration": true, + "workspaceFolders": true + } + } +} |