[-] Use class with custom attribute.should be able to mock Test-Foo 27ms (21ms|6ms)
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
RuntimeException: The following exception occurred while constructing the attribute "ValidateClass": "Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')"
PSInvalidCastException: Cannot convert value "Test-Foo" to type "System.Management.Automation.CommandMetadata". Error: "The following exception occurred while constructing the attribute "ValidateClass": "Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')""
RuntimeException: Cannot convert value "Test-Foo" to type "System.Management.Automation.CommandMetadata". Error: "The following exception occurred while constructing the attribute "ValidateClass": "Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')""
at <ScriptBlock>, /workspaces/Pester/src/functions/Mock.ps1:589
at Resolve-Command, /workspaces/Pester/src/functions/Mock.ps1:652
....
[-] Use class with custom attribute.should be able to run Test-Foo 14ms (8ms|6ms)
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
RuntimeException: The following exception occurred while constructing the attribute "ValidateClass": "Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')"
at <ScriptBlock>, /workspaces/Pester/tst/Pester.Mock.ClassMetadata.ps1:28
at <ScriptBlock>, /workspaces/Pester/src/Pester.Runtime.ps1:1468
..
[n] - generating parametrized tests from foreach without external id -> Expected $true but got 'False'.
at Verify-True, /workspaces/Pester/tst/axiom/Verify-True.ps1:12
at <ScriptBlock>, /workspaces/Pester/tst/Pester.Mock.RSpec.ts.ps1:824
/tst/Pester.RSpec.Coverage.ts.ps1
MethodInvocationException: /workspaces/Pester/src/functions/Coverage.ps1:1120:13
Line |
1120 | $profilerType::Register($tracer)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "Register" with "1" argument(s): "The provided tracer does not have Trace method with this signature: Trace(IScriptExtent extent, ScriptBlock scriptBlock, int level)"
...
[n] - Coverage is the same when breakpoints are used as when they are not used -> Expected not $null but got $null.
at Verify-NotNull, /workspaces/Pester/tst/axiom/Verify-NotNull.ps1:8
at <ScriptBlock>, /workspaces/Pester/tst/Pester.RSpec.Coverage.ts.ps1:76
./tst/functions/Coverage.Tests.ps1 - Almost everything fail.
InvalidOperationException: The provided tracer does not have Trace method with this signature: Trace(IScriptExtent extent, ScriptBlock scriptBlock, int level)
MethodInvocationException: Exception calling "Register" with "1" argument(s): "The provided tracer does not have Trace method with this signature: Trace(IScriptExtent extent, ScriptBlock scriptBlock, int level)"
Expected Behavior
All tests pass so I'm able to fully profile Pester's tests.
Steps To Reproduce
No response
Describe your environment
Pester version : 5.3.3 /workspaces/Pester/bin/Pester.psm1
PowerShell version : 7.2.1
OS version : Unix 5.10.102.1
Profiler version: 3.1.1
Possible Solution?
Not sure what's happening with the failed test in Pester.Mock.RSpec.ts.ps1.
Is this correct in Profiler 4? It looks for Trace(IScriptExtent, ScriptBlock, int, string) but it invokes Trace(IScriptExtent, ScriptBlock, int) in _traceMethod.
Checklist
What is the issue?
Running Pester's own tests inside Profiler fails.
Failing tests:
/tst/Pester.Mock.RSpec.ts.ps1
/tst/Pester.RSpec.Coverage.ts.ps1
./tst/functions/Coverage.Tests.ps1 - Almost everything fail.
Expected Behavior
All tests pass so I'm able to fully profile Pester's tests.
Steps To Reproduce
No response
Describe your environment
Pester version : 5.3.3 /workspaces/Pester/bin/Pester.psm1
PowerShell version : 7.2.1 OS version : Unix 5.10.102.1
Profiler version: 3.1.1
Possible Solution?
Not sure what's happening with the failed test in
Pester.Mock.RSpec.ts.ps1
.For the Coverage-tests: Add missing overloads for
Trace()
inCodeCoverageTracer.cs
that's compatible with Profiler 3 ExternalTraceAdapter and Profiler 4 ExternalTraceAdapter