summaryrefslogtreecommitdiff
path: root/tests/specs/compile/detect_cjs/__test__.jsonc
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-10-14 20:48:39 -0400
committerGitHub <noreply@github.com>2024-10-14 20:48:39 -0400
commit1a0cb5b5312941521ab021cfe9eaed498f35900b (patch)
tree2e5c58e25e8506b993ac678e83ba0c2feac37d75 /tests/specs/compile/detect_cjs/__test__.jsonc
parentee7d4501435f0ebd655c8b50bd6e41ca19e71abc (diff)
feat(unstable): `--unstable-detect-cjs` for respecting explicit `"type": "commonjs"` (#26149)
When using the `--unstable-detect-cjs` flag or adding `"unstable": ["detect-cjs"]` to a deno.json, it will make a JS file CJS if the closest package.json contains `"type": "commonjs"` and the file is not an ESM module (no TLA, no `import.meta`, no `import`/`export`).
Diffstat (limited to 'tests/specs/compile/detect_cjs/__test__.jsonc')
-rw-r--r--tests/specs/compile/detect_cjs/__test__.jsonc24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/specs/compile/detect_cjs/__test__.jsonc b/tests/specs/compile/detect_cjs/__test__.jsonc
new file mode 100644
index 000000000..32bebb7a5
--- /dev/null
+++ b/tests/specs/compile/detect_cjs/__test__.jsonc
@@ -0,0 +1,24 @@
+{
+ "tempDir": true,
+ "steps": [{
+ "if": "unix",
+ "args": "compile --allow-read --output main main.js",
+ "output": "compile.out"
+ }, {
+ "if": "unix",
+ "commandName": "./main",
+ "args": [],
+ "output": "output.out",
+ "exitCode": 1
+ }, {
+ "if": "windows",
+ "args": "compile --allow-read --output main.exe main.js",
+ "output": "compile.out"
+ }, {
+ "if": "windows",
+ "commandName": "./main.exe",
+ "args": [],
+ "output": "output.out",
+ "exitCode": 1
+ }]
+}