diff options
| author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-09-24 12:23:57 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-24 19:23:57 +0000 |
| commit | 36ebc03f177cc7db5deb93f4d403cafbed756eb5 (patch) | |
| tree | c36af6c9b7093d3191de3cd6e60c4ce9dca4151a /tests/specs/npm/lifecycle_scripts/__test__.jsonc | |
| parent | ba5b8d0213cde2585236098b00beb8a512889626 (diff) | |
fix(cli): Warn on not-run lifecycle scripts with global cache (#25786)
Refactors the lifecycle scripts code to extract out the common
functionality and then uses that to provide a warning in the global
resolver.
While ideally we would still support them with the global cache, for now
a warning is at least better than the status quo (where people are
unaware why their packages aren't working).
Diffstat (limited to 'tests/specs/npm/lifecycle_scripts/__test__.jsonc')
| -rw-r--r-- | tests/specs/npm/lifecycle_scripts/__test__.jsonc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/tests/specs/npm/lifecycle_scripts/__test__.jsonc b/tests/specs/npm/lifecycle_scripts/__test__.jsonc index f7a722a8b..201e42497 100644 --- a/tests/specs/npm/lifecycle_scripts/__test__.jsonc +++ b/tests/specs/npm/lifecycle_scripts/__test__.jsonc @@ -1,7 +1,7 @@ { + "tempDir": true, "tests": { "node_gyp": { - "tempDir": true, "steps": [ { "args": "cache --allow-scripts=npm:@denotest/node-addon main.js", @@ -14,7 +14,6 @@ ] }, "run_without_scripts": { - "tempDir": true, "steps": [ { "args": "run -A main.js", @@ -24,11 +23,9 @@ ] }, "implicit_node_gyp": { - "tempDir": true, "steps": [ { "envs": { - // I don't think this will work on windows "PATH": "" }, "args": "cache --allow-scripts implicit_node_gyp.js", @@ -38,7 +35,6 @@ ] }, "lifecycle_scripts": { - "tempDir": true, "steps": [ { // without running scripts (should warn) @@ -55,8 +51,25 @@ } ] }, + "global_lifecycle_scripts": { + "steps": [ + { + "args": ["eval", "Deno.removeSync('deno.json')"], + "output": "" + }, + { + // without running scripts (should warn) + "args": "install -e all_lifecycles.js", + "output": "all_lifecycles_not_run_global.out" + }, + { + // should not warn + "args": "install -e all_lifecycles.js", + "output": "" + } + ] + }, "only_warns_first": { - "tempDir": true, "steps": [ { // without running scripts (should warn) @@ -96,7 +109,6 @@ ] }, "lifecycle_scripts_conflicting_bin": { - "tempDir": true, "steps": [ { // we import @denotest/says-hello-on-install, which executes `say-hello` from `@denotest/say-hello` in its @@ -110,7 +122,6 @@ ] }, "fsevents_default_install_script": { - "tempDir": true, "steps": [ { "if": "mac", @@ -125,7 +136,6 @@ ] }, "lifecycle_scripts_no_deno_json": { - "tempDir": true, "steps": [ { "args": ["eval", "Deno.removeSync('deno.json')"], @@ -138,7 +148,6 @@ ] }, "lifecycle_scripts_no_deno_json_conflicting_bin": { - "tempDir": true, "steps": [ { "args": ["eval", "Deno.removeSync('deno.json')"], |
