Skip to content

Mock fallthrough

20b9cdd
Select commit
Loading
Failed to load commit list.
Draft

Remove Mock fallthrough #2654

Mock fallthrough
20b9cdd
Select commit
Loading
Failed to load commit list.
Azure Pipelines / Pester PR failed Jul 3, 2025 in 11m 0s

Build #20250703.1 had test failures

Details

Tests

  • Failed: 175 (1.14%)
  • Passed: 14,846 (97.07%)
  • Other: 273 (1.79%)
  • Total: 15,294

Annotations

Check failure on line 3211 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

Build log #L3211

 [-] <ScriptBlock> failed with:

Check failure on line 3799 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

Build log #L3799

 [-] When calling Mock on existing function without matching bound params.Should throw because not mock matched the invocation 15ms (14ms|1ms)

Check failure on line 3807 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

Build log #L3807

 [-] When calling Mock on existing function without matching unbound arguments.Should throw because not mock matched the invocation 19ms (19ms|1ms)

Check failure on line 3815 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

Build log #L3815

 [-] When calling Mock on a module-internal function..Using Mock -ModuleName "ModuleName" "CommandName" syntax.Should only call mocks within the same module 23ms (11ms|12ms)

Check failure on line 1 in When calling Mock on existing function without matching bound params.Should throw because not mock matched the invocation

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

When calling Mock on existing function without matching bound params.Should throw because not mock matched the invocation

Expected an exception with message like 'Mock felt though' to be thrown, but the message was 'The mock for command 'FunctionUnderTest' did not match any filtered behavior, and there was no default behavior.
Performed ParameterFilter evaluations:
mock filter: {  $param1 -eq "test"  } with parameters: param1 = badTest
'. from /home/vsts/work/1/s/bin/Pester.psm1:15517 char:17
    + …             throw "The mock for command '$($Hook.CommandName)' did no …
    +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Raw output
at { FunctionUnderTest "badTest" } | Should -Throw "Mock felt though", /home/vsts/work/1/s/tst/functions/Mock.Tests.ps1:378

Check failure on line 1 in When calling Mock on existing function without matching unbound arguments.Should throw because not mock matched the invocation

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

When calling Mock on existing function without matching unbound arguments.Should throw because not mock matched the invocation

Expected an exception with message like 'Mock felt though' to be thrown, but the message was 'The mock for command 'FunctionUnderTestWithoutParams' did not match any filtered behavior, and there was no default behavior.
Performed ParameterFilter evaluations:
mock filter: {  $param1 -eq "test" -and $args[0] -eq 'notArg0'  } with parameters: param1 = test
'. from /home/vsts/work/1/s/bin/Pester.psm1:15517 char:17
    + …             throw "The mock for command '$($Hook.CommandName)' did no …
    +               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Raw output
at { FunctionUnderTestWithoutParams -param1 "test" "arg0" } | Should -Throw "Mock felt though", /home/vsts/work/1/s/tst/functions/Mock.Tests.ps1:393

Check failure on line 1 in When calling Mock on a module-internal function..Using Mock -ModuleName "ModuleName" "CommandName" syntax.Should only call mocks within the same module

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

When calling Mock on a module-internal function..Using Mock -ModuleName "ModuleName" "CommandName" syntax.Should only call mocks within the same module

RuntimeException: The mock for command 'InternalFunction' did not match any filtered behavior, and there was no default behavior.
Performed ParameterFilter evaluations:
mock filter: {  $args[0] -eq 'Test'  } without any parameters

Check failure on line 1 in When calling Mock on a module-internal function..Using Mock -ModuleName "ModuleName" "CommandName" syntax.Should work even if the function is weird and steps on the automatic $ExecutionContext variable.

See this annotation in the file changed.

@azure-pipelines azure-pipelines / Pester PR

When calling Mock on a module-internal function..Using Mock -ModuleName "ModuleName" "CommandName" syntax.Should work even if the function is weird and steps on the automatic $ExecutionContext variable.

RuntimeException: The mock for command 'InternalFunction' did not match any filtered behavior, and there was no default behavior.
Performed ParameterFilter evaluations:
mock filter: {  $args[0] -eq 'Test'  } without any parameters