Closed nohwnd closed 5 months ago
The error detection is sweet. Took me half evening yesterday to figure out where the code was stopping to properly trace, and this does it automatically:
test.ps1 -cc
With inline.
Not sure what is the difference, but it is small enough to ignore.
shows summary in UI now as well, it is not super helpful, but it is there.
Fyi. The task PublishCodeCoverageResults@2
does not (yet?) support line coverage, but if using v1 the Pester.psm1
will be clickable and show coverage per line.
I tried that and I still don't see the uncovered lines in the breakdown.
@fhnaseer is there a way to make the new code coverage view (two posts above) more detailed than just summary per file? we are producing jacoco output.
See example here where you can see it show hits and misses per line (if you click on a file): https://dev.azure.com/dsccommunity/SqlServerDsc/_build/results?buildId=8834&view=codecoverage-tab
It only works with v1 though as I mentioned. See you updated it to v1 so maybe it doesn't find the sources, a parameter of the task that should point to the files that was tested. 🤔
In the SqlServerDsc case we use ModuleBuilder to build the module. So there are some extra work in our pipeline to convert the line numbers in JaCoCo back to the source files and their line numbers even if we tested the built module (psm1). That is why all commands etc is in separate files. That should not be needed in this case though.
Testing how we could measure CodeCoverage of Pester and P tests. The code above runs, except for one test in mock, which is strange since we can Profile pester tests. Maybe it was some fluke.
[x] The coverage shows 28% which seems too low, most of our tests run in process, so we maybe are resetting something somewhere. Or not pointing the code at the right files.
[x] This also needs to be made compatible with inlining the module.
[x] And Frode pointed out that tracer might not be both the same type.
[x] we also need finally to tear down
[x] and print summary
[x] We are probably not setting that one extra BP that we should be seetting, if all breakpoints are removed Set-Trace will turn off, check profiler what it does, so we can re-enable the test in Mock that removes just it's breakpoints. https://github.com/nohwnd/Profiler/issues/67
[x] ~Coverage tests fail but it is imho okay to skip~ these were mock tests, solved
[x] coverage.ts tests break the coverage because they turn off tracing
[x] this also higlights that when we profile Pester using PRofiler we are most likely not getting trace of all tests, so there are probably some other Perf wins hiding
Fix #2475