summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/lsp_tests.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index 78aff93ab..e9a4db535 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -9469,6 +9469,61 @@ export function B() {
client.shutdown();
}
+#[test]
+fn lsp_jsx_import_source_config_file_automatic_cache() {
+ let context = TestContextBuilder::new()
+ .use_http_server()
+ .use_temp_cwd()
+ .build();
+ let temp_dir = context.temp_dir();
+ temp_dir.write(
+ "deno.json",
+ json!({
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "http://localhost:4545/jsx",
+ },
+ })
+ .to_string(),
+ );
+ let mut client = context.new_lsp_command().build();
+ client.initialize_default();
+ let mut diagnostics = client.did_open(json!({
+ "textDocument": {
+ "uri": temp_dir.uri().join("file.tsx").unwrap(),
+ "languageId": "typescriptreact",
+ "version": 1,
+ "text": "
+ export function Foo() {
+ return <div></div>;
+ }
+ ",
+ },
+ }));
+ // The caching is done on an asynchronous task spawned after init, so there's
+ // a chance it wasn't done in time and we need to wait for another batch of
+ // diagnostics.
+ while !diagnostics.all().is_empty() {
+ std::thread::sleep(std::time::Duration::from_millis(50));
+ // The post-cache diagnostics update triggers inconsistently on CI for some
+ // reason. Force it with this notification.
+ diagnostics = client.did_open(json!({
+ "textDocument": {
+ "uri": temp_dir.uri().join("file.tsx").unwrap(),
+ "languageId": "typescriptreact",
+ "version": 1,
+ "text": "
+ export function Foo() {
+ return <div></div>;
+ }
+ ",
+ },
+ }));
+ }
+ assert_eq!(diagnostics.all(), vec![]);
+ client.shutdown();
+}
+
#[derive(Debug, Clone, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
struct TestData {