fix: report blocked install scripts when reify or a root script fails - #9945
Open
lazerg wants to merge 2 commits into
Open
fix: report blocked install scripts when reify or a root script fails#9945lazerg wants to merge 2 commits into
lazerg wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / Why
reifyFinishis what prints the "install scripts blocked because they are not covered by allowScripts" warning, and it runs last. Anything that throws before it, either the reify itself or one of the root lifecycle scripts that follow it, exits the command with the warning never printed. That is the case where it matters most: the rootpreparetypically fails because a dependency'spostinstallwas skipped, and all the user gets is an unrelated stack trace from somewhere insidenode_modules.npm install <pkg>prints the warning fine, since that path never runs the root lifecycle scripts at all.npm installandnpm cinow report the blocked scripts before rethrowing. A failed reify rolls its tree back, so the report reads off the ideal tree rather thanactualTree. The message itself moved into its own module so the commands andreify-outputcan share it; its content is unchanged.Testing
New regression tests on both commands for a root
preparethat exits non-zero, plus one for a reify that fails outright, each with a dependency whosepostinstallis blocked, asserting the warning is logged before the command rejects. Also checked by hand against a project withfile:dependencies, covering both a failing rootprepareand a failing dependency script: the warning lands on stderr, prints once on the success path,--silentstill suppresses it, and--jsonleaves stdout valid JSON.References
Fixes #9943