`Get-CodeCoverageResult`: New command proposal

未关闭
#170 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
powershell
领域
cli, testing-qa

调研方向

未指定实现文件或测试。首先检查现有的 Invoke-Pester 配置以及 issue 中描述的 PesterObject CodeCoverage.CommandsMissed 输出,然后确定应如何集成所提议的命令以及 Type、Name 和 AddSource 参数。当所请求的未覆盖、已执行和已筛选 coverage 结果可通过所提议的 CLI 命令获得时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

enhancement help wanted
Details of the scenario you tried and the problem that is occurring

It is very complicated to get the code coverage for a certan function or class through CLI. Suggest adding a command that can make it less difficult:

Invoke-PesterWithCodeCoverage: runs Pester with required configuration and returns a PesterObject. The command should take an optional PesterConfiguration parameter, but use default if not specified.

Get-CodeCoverageResult: The command should take the parameters:

PesterObject (mandatory)
Name (optional, array of class and function names being tested)
AddSource (optional, only applicable when built module using ModuleBuilder)
Type (optional, either Missed, Executed or All - defaults to Missed only)

Should add a new property Type to the resulting objects with Missed or Executed

Returns the CommandsMissed

$config = New-PesterConfiguration
$config.Run.Path = @('<test paths>')
$config.CodeCoverage.Enabled = $true
$config.CodeCoverage.Path = @('./output/builtModule/<ModuleName>')
$config.CodeCoverage.CoveragePercentTarget = 0
$config.Output.Verbosity = 'None'
$config.Run.PassThru = $true
$result = Invoke-Pester -Configuration $config
# After running above, get all commands that was missed with a reference to the SourceLineNumber in SourceFile.
$result.CodeCoverage.CommandsMissed | Where-Object { $_.Function -eq '<FunctionName>' -or $_.Class -eq '<ClassName>' } | Convert-LineNumber -PassThru | Select-Object Class, Function, Command, SourceLineNumber, SourceFile
Steps to reproduce the problem
Expected behavior
Current behavior
Suggested solution to the issue
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the module that was used
主要语言
PowerShell
星标
6
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dsccommunity/DscResource.Test 的其他 Issue

查看 dsccommunity/DscResource.Test 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。