code-coverage - 如何使用 Pester 获取所有分支的代码覆盖率?

标签 code-coverage chocolatey pester

多个test cases已编写用于使用 Pester 测试新的 Chocolatey 函数。如何检查是否所有分支都被覆盖?

最佳答案

当前版本的 Pester (3.0) 确实支持代码覆盖率。

简单地使用

Invoke-Pester -CodeCoverage *.ps1

获得代码覆盖率(覆盖率%)的完整关系以及测试期间未执行的所有代码行(分支)的摘要:

Tests completed in 10.11s
Passed: 66 Failed: 0 Skipped: 0 Pending: 0

Code coverage report:
Covered 99,20 % of 501 analyzed commands in 22 files.

Missed commands:

File                  Function          Line Command
----                  --------          ---- -------
Set-ProgressColor.ps1 Set-ProgressColor   19 Write-Verbose "Progress colors are only supported on the PowerShell com...

关于code-coverage - 如何使用 Pester 获取所有分支的代码覆盖率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24664565/

相关文章:

c# - 代码抛出异常后缺少右大括号的代码覆盖率

node.js - Nodeunit - JSCovrage

chocolatey - 无法使用 Install-ChocolateyZipPackage 函数提取 tar.gz 包

azure - Pester/PowerShell 输出应匹配/包含 $a 或 $b

powershell - 确定PSCustomObject的数组是否包含具有属性值的实例

java - 我的 gradle 多项目 + java + groovy + clover + sonarqube 无法在 Sonar 中达到 100% 代码覆盖率

CMake/CTest & gcovr : filename extensions?

powershell - 如何将 Chocolatey 函数、核心和扩展导入 PowerShell session ?

powershell - 是否可以仅使用程序和shimgen的setup.exe来使用C​​hocolatey创建静默安装程序?

powershell - 运行pester测试时如何使管道中的输出出现在控制台上?