summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/npm_tests.rs8
-rw-r--r--cli/tests/testdata/npm/file_dts_dmts_dcts/main.out24
-rw-r--r--cli/tests/testdata/npm/file_dts_dmts_dcts/main.ts9
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.cjs0
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.cts1
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.mts1
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.ts1
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.js0
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.mjs0
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/package.json13
10 files changed, 57 insertions, 0 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index e14da4aca..a16dd5354 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -2088,3 +2088,11 @@ itest!(reserved_word_exports {
envs: env_vars_for_npm_tests(),
http_server: true,
});
+
+itest!(check_package_file_dts_dmts_dcts {
+ args: "check npm/file_dts_dmts_dcts/main.ts",
+ output: "npm/file_dts_dmts_dcts/main.out",
+ envs: env_vars_for_npm_tests_no_sync_download(),
+ http_server: true,
+ exit_code: 1,
+});
diff --git a/cli/tests/testdata/npm/file_dts_dmts_dcts/main.out b/cli/tests/testdata/npm/file_dts_dmts_dcts/main.out
new file mode 100644
index 000000000..c92043f8b
--- /dev/null
+++ b/cli/tests/testdata/npm/file_dts_dmts_dcts/main.out
@@ -0,0 +1,24 @@
+Download http://localhost:4545/npm/registry/@denotest/file-dts-dmts-dcts
+Download http://localhost:4545/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0.tgz
+Check file:///[WILDCARD]/main.ts
+error: TS2322 [ERROR]: Type '5' is not assignable to type '"dts"'.
+const value1: Dts1 = 5;
+ ~~~~~~
+ at file:///[WILDCARD]
+
+TS2322 [ERROR]: Type '5' is not assignable to type '"mts"'.
+const value2: Mts1 = 5;
+ ~~~~~~
+ at file:///[WILDCARD]
+
+TS2322 [ERROR]: Type '5' is not assignable to type '"mts"'.
+const value3: Mts2 = 5;
+ ~~~~~~
+ at file:///[WILDCARD]
+
+TS2322 [ERROR]: Type '5' is not assignable to type '"cts"'.
+const value4: Cts1 = 5;
+ ~~~~~~
+ at file:///[WILDCARD]
+
+Found 4 errors.
diff --git a/cli/tests/testdata/npm/file_dts_dmts_dcts/main.ts b/cli/tests/testdata/npm/file_dts_dmts_dcts/main.ts
new file mode 100644
index 000000000..63686e2d3
--- /dev/null
+++ b/cli/tests/testdata/npm/file_dts_dmts_dcts/main.ts
@@ -0,0 +1,9 @@
+import { Value as Dts1 } from "npm:@denotest/file-dts-dmts-dcts/js";
+import { Value as Mts1 } from "npm:@denotest/file-dts-dmts-dcts";
+import { Value as Mts2 } from "npm:@denotest/file-dts-dmts-dcts/mjs";
+import { Value as Cts1 } from "npm:@denotest/file-dts-dmts-dcts/cjs";
+
+const value1: Dts1 = 5;
+const value2: Mts1 = 5;
+const value3: Mts2 = 5;
+const value4: Cts1 = 5;
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.cjs b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.cjs
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.cjs
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.cts b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.cts
new file mode 100644
index 000000000..43a5ebe9b
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.cts
@@ -0,0 +1 @@
+export type Value = "cts";
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.mts b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.mts
new file mode 100644
index 000000000..b762ebd4a
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.mts
@@ -0,0 +1 @@
+export type Value = "mts";
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.ts b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.ts
new file mode 100644
index 000000000..1d1cd270b
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.d.ts
@@ -0,0 +1 @@
+export type Value = "dts";
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.js b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.js
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.mjs b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.mjs
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/main.mjs
diff --git a/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/package.json
new file mode 100644
index 000000000..1884b65e4
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/file-dts-dmts-dcts/1.0.0/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "@denotest/dts-and-dmts-same-file",
+ "version": "1.0.0",
+ "exports": {
+ ".": {
+ "import": "./main.mjs",
+ "require": "./main.js"
+ },
+ "./mjs": "./main.mjs",
+ "./cjs": "./main.cjs",
+ "./js": "./main.js"
+ }
+} \ No newline at end of file