feat: --fail-on-warnings / failOnWarnings#7068
Open
NormalGaussian wants to merge 1 commit intoyarnpkg:masterfrom
Open
feat: --fail-on-warnings / failOnWarnings#7068NormalGaussian wants to merge 1 commit intoyarnpkg:masterfrom
NormalGaussian wants to merge 1 commit intoyarnpkg:masterfrom
Conversation
The option --fail-on-warnings / failOnWarnings causes executions which emit warnings to exit with a non-zero exit code (1).
Author
|
The failing checks appear to be the |
Open
1 task
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.
yarn commands can be made to exit with a non-zero status code due to the presence of warnings logged during execution.
What's the problem this PR addresses?
Its a partial resolution to #7066
CI / testing workflows want to proactively avoid bugs and issues in the repo's they manage whilst being clear and easy to maintain themselves. Yarn emitting warnings is a clear indication of potential bugs and issues in the repo, but it is not clear and easy to detect such warnings. A simple grep is prone to false positives (e.g. a package name) and more complex solutions are difficult to understand, adequately maintain, and demonstrate as being free of bugs e.g.
yarn install --fail-on-warningsis a lot simpler.How did you fix it?
The CLI option
--fail-on-warningswas added as an option toBaseCommandand its presence propagated toStreamReport.start({...})asfailOnWarnings. WhenStreamReportdetermines theexitCodeit now takes into consideration thefailOnWarningssetting and the presence of warnings.Of note: the change was added to
BaseCommand, which seemed the most appropriate as this is a generic behaviour, but it was added as a hidden option as it seemed to confusingly polluteyarn -hfor most users, for what is generally a CI option. This has made it unclear as to how best to document.Checklist