(#2851) fix license validation output#2857
Conversation
|
Question regarding some tests for this: I checked out the |
The LicenseValidation logging logic was only checking for `-v` or `--version` as the first arguments. This completely ignored `-r`, `--limit-output`, and `--limitoutput`. Additionally, a few places weren't suppressing output when limit output was used. This change correctly detects if regular output is desired, and if it is then it marks the output accordingly, otherwise it outputs to the log file only.
006a2bf to
7437a22
Compare
I think that should be sufficient enough for these changes. But since this is a while ago, I doubt this test exist anymore. |
Add comprehensive Pester tests for the `--limitoutput` and related flags to verify output behavior when license files are missing, misplaced, or invalid. These tests ensure that no misleading license-related messages are shown during command execution, improving reliability and user experience when using the limit-output feature.
|
@corbob thanks for getting this started, and to @AdmiringWorm for getting this over the line! |

Description Of Changes
Update the logic used in LicenseValidation class to correctly detect when regular output is desired and when it's not.
Motivation and Context
When there are certain license conditions, Chocolatey would report things to standard output even if the command issues was requesting to limit output.
Testing
licensedirectory and ranchoco list --local-only --limit-outputchoco list --local-only --limitoutputchoco list --local-only -rlicense/chocolatey.license.xml. Noted that limit output prevented the message about the license being invalidThis is currently a draft PR as I intend to add some Pester tests to verify that no extraneous output occurs when limit output is requested.
Change Types Made
Related Issue
Fixes #2851
Change Checklist