`Get-CodeCoverageResult`: New command proposal

Đang mở
#170 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
powershell
Lĩnh vực
cli, testing-qa

Hướng nghiên cứu

Không có tệp triển khai hoặc bài kiểm thử nào được nêu tên. Trước tiên, hãy xem xét cấu hình Invoke-Pester hiện có và đầu ra PesterObject CodeCoverage.CommandsMissed được mô tả trong issue, sau đó xác định cách các lệnh được đề xuất cùng với các tham số Type, Name và AddSource nên được tích hợp. Công việc được xem là hoàn tất khi các kết quả coverage được yêu cầu cho các mục bị bỏ sót, đã thực thi và đã lọc có thể được truy cập thông qua các lệnh CLI được đề xuất.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
PowerShell
Star
6
Fork
9
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dsccommunity/DscResource.Test

Tất cả issue của dsccommunity/DscResource.Test

Issue tương tự

Thêm issue về CLI

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.