summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/npm_tests.rs7
-rw-r--r--cli/tests/testdata/npm/dual_cjs_esm/main.out1
-rw-r--r--cli/tests/testdata/npm/dual_cjs_esm/main.ts3
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.cjs3
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.mjs3
-rw-r--r--cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/package.json7
6 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index 059fac99b..6d0495454 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -75,6 +75,13 @@ itest!(conditional_exports {
http_server: true,
});
+itest!(dual_cjs_esm {
+ args: "run --unstable -A --quiet npm/dual_cjs_esm/main.ts",
+ output: "npm/dual_cjs_esm/main.out",
+ envs: env_vars(),
+ http_server: true,
+});
+
itest!(dynamic_import {
args: "run --allow-read --allow-env --unstable npm/dynamic_import/main.ts",
output: "npm/dynamic_import/main.out",
diff --git a/cli/tests/testdata/npm/dual_cjs_esm/main.out b/cli/tests/testdata/npm/dual_cjs_esm/main.out
new file mode 100644
index 000000000..3d329be7a
--- /dev/null
+++ b/cli/tests/testdata/npm/dual_cjs_esm/main.out
@@ -0,0 +1 @@
+esm
diff --git a/cli/tests/testdata/npm/dual_cjs_esm/main.ts b/cli/tests/testdata/npm/dual_cjs_esm/main.ts
new file mode 100644
index 000000000..3e80402c6
--- /dev/null
+++ b/cli/tests/testdata/npm/dual_cjs_esm/main.ts
@@ -0,0 +1,3 @@
+import { getKind } from "npm:@denotest/dual-cjs-esm";
+
+console.log(getKind());
diff --git a/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.cjs b/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.cjs
new file mode 100644
index 000000000..990605527
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.cjs
@@ -0,0 +1,3 @@
+exports.getKind = function() {
+ return "cjs";
+};
diff --git a/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.mjs b/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.mjs
new file mode 100644
index 000000000..b48b9a3a6
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/index.mjs
@@ -0,0 +1,3 @@
+export function getKind() {
+ return "esm";
+}
diff --git a/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/package.json
new file mode 100644
index 000000000..e0315b7f6
--- /dev/null
+++ b/cli/tests/testdata/npm/registry/@denotest/dual-cjs-esm/1.0.0/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@denotest/dual-cjs-esm",
+ "version": "1.0.0",
+ "type": "module",
+ "main": "./index.cjs",
+ "module": "./index.mjs"
+}