diff options
Diffstat (limited to 'tests')
4 files changed, 28 insertions, 2 deletions
diff --git a/tests/specs/npm/lifecycle_scripts/__test__.jsonc b/tests/specs/npm/lifecycle_scripts/__test__.jsonc index 201e42497..b798b968f 100644 --- a/tests/specs/npm/lifecycle_scripts/__test__.jsonc +++ b/tests/specs/npm/lifecycle_scripts/__test__.jsonc @@ -64,12 +64,17 @@ }, { // should not warn - "args": "install -e all_lifecycles.js", + "args": "run all_lifecycles_global.js", "output": "" + }, + { + // should warn still + "args": "install -e all_lifecycles.js", + "output": "all_lifecycles_not_run_global_cached.out" } ] }, - "only_warns_first": { + "only_warns_first_run": { "steps": [ { // without running scripts (should warn) @@ -82,6 +87,11 @@ "args": "run all_lifecycles.js", "output": "only_warns_first2.out", "exitCode": 1 + }, + { + // should warn because this is an explicit install + "args": "install -e all_lifecycles.js", + "output": "warns_again_on_install.out" } ] }, diff --git a/tests/specs/npm/lifecycle_scripts/all_lifecycles_global.js b/tests/specs/npm/lifecycle_scripts/all_lifecycles_global.js new file mode 100644 index 000000000..eccf11a6d --- /dev/null +++ b/tests/specs/npm/lifecycle_scripts/all_lifecycles_global.js @@ -0,0 +1,3 @@ +try { + const _ = await import("npm:@denotest/node-lifecycle-scripts"); +} catch (_) {} diff --git a/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run_global_cached.out b/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run_global_cached.out new file mode 100644 index 000000000..789c9346a --- /dev/null +++ b/tests/specs/npm/lifecycle_scripts/all_lifecycles_not_run_global_cached.out @@ -0,0 +1,7 @@ +Warning The following packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed: +┠─ npm:@denotest/node-lifecycle-scripts@1.0.0 +┃ +┠─ This may cause the packages to not work correctly. +┠─ Lifecycle scripts are only supported when using a `node_modules` directory. +┠─ Enable it in your deno config file: +┖─ "nodeModulesDir": "auto" diff --git a/tests/specs/npm/lifecycle_scripts/warns_again_on_install.out b/tests/specs/npm/lifecycle_scripts/warns_again_on_install.out new file mode 100644 index 000000000..fe7eedc56 --- /dev/null +++ b/tests/specs/npm/lifecycle_scripts/warns_again_on_install.out @@ -0,0 +1,6 @@ +Warning The following packages contained npm lifecycle scripts (preinstall/install/postinstall) that were not executed: +┠─ npm:@denotest/node-lifecycle-scripts@1.0.0 +┃ +┠─ This may cause the packages to not work correctly. +┖─ To run lifecycle scripts, use the `--allow-scripts` flag with `deno install`: + deno install --allow-scripts=npm:@denotest/node-lifecycle-scripts@1.0.0 |