Change to Error Message in PowerShell test suite

Current a majority of the test suites in PowerShell when testing for an error being throw is structure like this:

It "test name" {
    { Function -Param $Data } | Should -Throw "Specific error msg wanted"
}

This has a disadvantage for flexibility, because as the example above implied, the test required a specific 100% matched string to be throw.

But with just a simple tweak:

It "test name" {
    { Function -Param $Data } | Should -Throw "*Specific error msg wanted*"
}

With the * wrap, we only need to match the required text somewhere in the whole message. So for exmaple people can throw “Error: Specific error msg wanted”, and it would still pass along with all the old submissions.

This has been my way of implemented for throwing error tests in later exercises, but a good number of earlier ones stuck with the former rigid way.

From my conversation with some of the learners, they really like the ParameterValidation of powershell, but it has its own extra default msg that come with it. You can sometimes set an extra custom error message, but it would still came out extra like this:

Cannot validate argument on parameter 'param'. Specific error msg wanted
^
This part here is default

So with the old rigid test learners can’t implement ParameterValidation, but with the method with * wrapping they can throw error however they want as long as it has the specific wanted msg somewhere in it.

I will probably start doing this change for many exercises test suite next week if there is no objection to this. @ErikSchierboom @Meatball

As I mentioned above, this will have no effect on already passed solution and will allow more freedom for newer learners, so I don’t want to trigger and run test again on existing solutions. Please give me a quick guide of how to avoid that.

Sounds good!

You’ll have to merged the PR with [no important files changed] in the commit message. See Building Tracks | Exercism's Docs

I think it also sounds good