summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/lsp_tests.rs24
-rw-r--r--cli/tests/integration/watcher_tests.rs41
2 files changed, 45 insertions, 20 deletions
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index 04b17ef00..52f1e55ba 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -5612,7 +5612,7 @@ fn lsp_cache_location() {
"text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n// @deno-types=\"http://127.0.0.1:4545/type_definitions/foo.d.ts\"\nimport * as b from \"http://127.0.0.1:4545/type_definitions/foo.js\";\nimport * as c from \"http://127.0.0.1:4545/subdir/type_reference.js\";\nimport * as d from \"http://127.0.0.1:4545/subdir/mod1.ts\";\nimport * as e from \"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=\";\nimport * as f from \"./file_01.ts\";\nimport * as g from \"http://localhost:4545/x/a/mod.ts\";\n\nconsole.log(a, b, c, d, e, f, g);\n"
}
}));
- assert_eq!(diagnostics.all().len(), 7);
+ assert_eq!(diagnostics.all().len(), 6);
client.write_request(
"deno/cache",
json!({
@@ -5708,7 +5708,7 @@ fn lsp_tls_cert() {
}
}));
let diagnostics = diagnostics.all();
- assert_eq!(diagnostics.len(), 7);
+ assert_eq!(diagnostics.len(), 6);
client.write_request(
"deno/cache",
json!({
@@ -7609,25 +7609,9 @@ fn lsp_data_urls_with_jsx_compiler_option() {
}
})).all();
- // there will be a diagnostic about not having cached the data url
- assert_eq!(diagnostics.len(), 1);
- assert_eq!(
- diagnostics[0].code,
- Some(lsp::NumberOrString::String("no-cache-data".to_string()))
- );
+ assert_eq!(diagnostics.len(), 0);
- // so cache it
- client.write_request(
- "deno/cache",
- json!({
- "referrer": {
- "uri": uri,
- },
- "uris": [],
- }),
- );
-
- let res = client.write_request(
+ let res: Value = client.write_request(
"textDocument/references",
json!({
"textDocument": {
diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs
index e844a2efe..8b8bbb0bf 100644
--- a/cli/tests/integration/watcher_tests.rs
+++ b/cli/tests/integration/watcher_tests.rs
@@ -1255,6 +1255,47 @@ async fn test_watch_unload_handler_error_on_drop() {
check_alive_then_kill(child);
}
+#[tokio::test]
+async fn run_watch_blob_urls_reset() {
+ let _g = util::http_server();
+ let t = TempDir::new();
+ let file_to_watch = t.path().join("file_to_watch.js");
+ let file_content = r#"
+ const prevUrl = localStorage.getItem("url");
+ if (prevUrl == null) {
+ console.log("first run, storing blob url");
+ const url = URL.createObjectURL(
+ new Blob(["export {}"], { type: "application/javascript" }),
+ );
+ await import(url); // this shouldn't insert into the fs module cache
+ localStorage.setItem("url", url);
+ } else {
+ await import(prevUrl)
+ .then(() => console.log("importing old blob url incorrectly works"))
+ .catch(() => console.log("importing old blob url correctly failed"));
+ }
+ "#;
+ file_to_watch.write(file_content);
+ let mut child = util::deno_cmd()
+ .current_dir(util::testdata_path())
+ .arg("run")
+ .arg("--watch")
+ .arg(&file_to_watch)
+ .env("NO_COLOR", "1")
+ .stdout(std::process::Stdio::piped())
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap();
+ let (mut stdout_lines, mut stderr_lines) = child_lines(&mut child);
+ wait_contains("first run, storing blob url", &mut stdout_lines).await;
+ wait_contains("finished", &mut stderr_lines).await;
+ file_to_watch.write(file_content);
+ wait_contains("importing old blob url correctly failed", &mut stdout_lines)
+ .await;
+ wait_contains("finished", &mut stderr_lines).await;
+ check_alive_then_kill(child);
+}
+
#[cfg(unix)]
#[tokio::test]
async fn test_watch_sigint() {