Repository navigation
Conversation
A test of New-IslFinding left out the mandatory -Context and expected an error. PowerShell raises that error only in a host that cannot prompt. In one that can, it asks for the value, and the suite waited there: at a console, and wherever the standard input stayed open. The CI steps have no input to read, so they never showed it. The test reads the mandatory parameters from the command instead. A new test parses every test file and fails for a call to a function of the module that leaves out a mandatory parameter, so that such a call fails where it is written and not where the suite happens to run. Closes #93.
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.
Summary
Closes #93. One test of
New-IslFindingleft out a mandatory parameter and expected an error. PowerShell raises that error only in a host that cannot prompt; in one that can, it asks for the value, and./Tests/Invoke-Tests.ps1waited at that test for as long as nobody answered. The CI jobs have no input to read, so they never showed it.This pull request is independent of the others and is based on
main.Changes
Tests/Unit/Private/New-IslFinding.Tests.ps1reads the four mandatory parameters from the command withShould-HaveParameter -Mandatory, as the other test files do. The assertion on-Severity Fatalstays: every mandatory parameter is given there, so the validation fails without a prompt.Tests/Unit/Module.Prompt.Tests.ps1. It parses every test file underTestsandValidation/Testsand fails for a call to a function of the module, private ones included, that gives none of its parameter sets all of its mandatory parameters. A parameter counts as given by name, by an unambiguous prefix, by an alias or by position. A call with a splat or with pipeline input is not judged. Six cases check the scan itself on sample text.Verification
mainit was still waiting after 60 seconds, under PowerShell 7.6.10 and under Windows PowerShell 5.1.26100; with this change it ended with 3 passed, under both.mainreportsNew-IslFinding.Tests.ps1:25 New-IslFinding without Contextand nothing else in the 91 test files.quality-gates.ymlruns them on this pull request.Notes
& $command) or a parameter that a splat was meant to carry and does not. Neither occurs in the test files today.