summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-07-19 11:59:04 -0700
committerGitHub <noreply@github.com>2024-07-19 18:59:04 +0000
commita4c76add565b9674ef6880de88013948c61a1ce5 (patch)
tree6dc75f90b2788b1028453308f3b46708d460936f /tests/specs
parentf6c7c13764a7952b878a2141fdf01ed68d169ea2 (diff)
fix(cli): Respect implied BYONM from DENO_FUTURE in `deno task` (#24652)
Regression from https://github.com/denoland/deno/commit/04f9db5b2217fe06f88e76146aac6362ff0b0b86 Originally I thought to fix the issue in the PR we needed to explicitly pass through the `node-modules-dir` flag, but after applying the correct fix that david pointed out (setting `NPM_PROCESS_STATE`) that wasn't necessary (or correct). We had a test for deno task with BYONM, but it only tested with `"unstable": ["byonm"]` in deno.json, so it didn't catch this.
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/npm/lifecycle_scripts/__test__.jsonc13
-rw-r--r--tests/specs/task/byonm/__test__.jsonc68
2 files changed, 64 insertions, 17 deletions
diff --git a/tests/specs/npm/lifecycle_scripts/__test__.jsonc b/tests/specs/npm/lifecycle_scripts/__test__.jsonc
index b862b8126..302b40d1e 100644
--- a/tests/specs/npm/lifecycle_scripts/__test__.jsonc
+++ b/tests/specs/npm/lifecycle_scripts/__test__.jsonc
@@ -132,6 +132,19 @@
"output": "no_deno_json.out"
}
]
+ },
+ "lifecycle_scripts_no_deno_json_conflicting_bin": {
+ "tempDir": true,
+ "steps": [
+ {
+ "args": ["eval", "Deno.removeSync('deno.json')"],
+ "output": ""
+ },
+ {
+ "args": "cache --allow-scripts --node-modules-dir=true conflicting_bin.js",
+ "output": "conflicting_bin.out"
+ }
+ ]
}
}
}
diff --git a/tests/specs/task/byonm/__test__.jsonc b/tests/specs/task/byonm/__test__.jsonc
index 670f6767d..3d62a7887 100644
--- a/tests/specs/task/byonm/__test__.jsonc
+++ b/tests/specs/task/byonm/__test__.jsonc
@@ -1,20 +1,54 @@
{
"tempDir": true,
- "steps": [{
- "commandName": "npm",
- "args": "install",
- "output": "[WILDCARD]"
- }, {
- "args": "task say",
- "output": "package_json_say.out"
- }, {
- "args": "task think",
- "output": "package_json_think.out"
- }, {
- "args": "task deno-say",
- "output": "deno_json_say.out"
- }, {
- "args": "task deno-think",
- "output": "deno_json_think.out"
- }]
+ "tests": {
+ "deno_json": {
+ "steps": [{
+ "commandName": "npm",
+ "args": "install",
+ "output": "[WILDCARD]"
+ }, {
+ "args": "task say",
+ "output": "package_json_say.out"
+ }, {
+ "args": "task think",
+ "output": "package_json_think.out"
+ }, {
+ "args": "task deno-say",
+ "output": "deno_json_say.out"
+ }, {
+ "args": "task deno-think",
+ "output": "deno_json_think.out"
+ }]
+ },
+ "no_deno_json": {
+ "steps": [{
+ "args": [
+ "eval",
+ "Deno.removeSync('deno.json')"
+ ],
+ "output": ""
+ }, {
+ "commandName": "npm",
+ "args": "install",
+ "output": "[WILDCARD]"
+ }, {
+ // implied byonm from DENO_FUTURE
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "args": "task say",
+ "output": "package_json_say.out"
+ }, {
+ // byonm flag
+ "args": "task --unstable-byonm say",
+ "output": "package_json_say.out"
+ }, {
+ "args": [
+ "eval",
+ "try { Deno.statSync('node_modules/.deno'); } catch (e) { if (e instanceof Deno.errors.NotFound) { console.log('good'); } else { throw new Error('bad'); } }"
+ ],
+ "output": "good\n"
+ }]
+ }
+ }
}