summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs6
-rw-r--r--cli/tests/type_headers_deno_types.ts18
-rw-r--r--cli/tests/type_headers_deno_types.ts.out5
3 files changed, 29 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 87b436a08..ea76fe23b 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -1961,6 +1961,12 @@ itest!(type_directives_redirect {
http_server: true,
});
+itest!(type_headers_deno_types {
+ args: "run --reload type_headers_deno_types.ts",
+ output: "type_headers_deno_types.ts.out",
+ http_server: true,
+});
+
itest!(ts_type_imports {
args: "run --reload ts_type_imports.ts",
output: "ts_type_imports.ts.out",
diff --git a/cli/tests/type_headers_deno_types.ts b/cli/tests/type_headers_deno_types.ts
new file mode 100644
index 000000000..7e5438cdb
--- /dev/null
+++ b/cli/tests/type_headers_deno_types.ts
@@ -0,0 +1,18 @@
+/**
+ * Following import uses two distinct ways to provide types:
+ * - X-TypeScript-Types headers
+ * - @deno-types directive
+ *
+ * Because "@deno-types" directive must be placed by user explicitly it
+ * should have higher precedence than type header.
+ *
+ * This is verified by providing conflicting type declaration
+ * depending on a way. There should be no TS error, otherwise
+ * it means that wrong type declarations are used (from X-TypeScript-Types)
+ * header.
+ */
+
+// @deno-types="http://127.0.0.1:4545/type_headers_deno_types.foo.d.ts"
+import { foo } from "http://127.0.0.1:4545/type_headers_deno_types.foo.js";
+
+foo("hello");
diff --git a/cli/tests/type_headers_deno_types.ts.out b/cli/tests/type_headers_deno_types.ts.out
new file mode 100644
index 000000000..f1e4ca1f8
--- /dev/null
+++ b/cli/tests/type_headers_deno_types.ts.out
@@ -0,0 +1,5 @@
+Download http://[WILDCARD]:4545/type_headers_deno_types.foo.js
+Download http://[WILDCARD]:4545/type_headers_deno_types.foo.d.ts
+Download http://[WILDCARD]:4545/type_headers_deno_types.d.ts
+Check [WILDCARD]/type_headers_deno_types.ts
+hello