gaelcolas / gaelcolas/SampleModule

Pester and DLL locking

Đang mở
#16 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
PowerShell
Star
43
Fork
8
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Adding the discussion in case there's a better suggestion floating around.

If a module incorporates an assembly, DLL files containing the assembly are loaded and locked. DLL files cannot be unloaded without restarting PowerShell.

In Indented.Build I invoke module tests using the snippet at the bottom, where "IsAdministrator" is the usual role check. However, I'm not keen on the administrator requirement this introduces.

A possible alternative is to invoke pester via Start-Process. The downside to this approach is that it squashes any prettified output.

This issue does not apply when using a build server. A build is typically executed in a spawned session which is destroyed after the build. Repeated building is really a feature of working in a development environment.

Any thoughts?
```
$invokePester = {
param (
$buildInfo
)

Import-Module $buildInfo.ReleaseManifest -Global -ErrorAction Stop
$params = @{
Script = Join-Path $buildInfo.Source 'test'
CodeCoverage = $buildInfo.ReleaseRootModule
OutputFile = Join-Path $buildInfo.Output ('{0}.xml' -f $buildInfo.ModuleName)
PassThru = $true
}
Invoke-Pester @params
}
if ($buildInfo.IsAdministrator) {
$pester = Invoke-Command $invokePester -ArgumentList $buildInfo -ComputerName $env:COMPUTERNAME
} else {
$pester = & $invokePester $buildInfo
}

$path = Join-Path $buildInfo.Output 'pester-output.xml'
$pester | Export-CliXml $path
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với lời gọi kiểm thử mô-đun Indented.Build được nêu trong issue, bao gồm Invoke-Pester, Invoke-Command và phương án thay thế Start-Process. Xác định cách các bản build phát triển lặp lại có thể tránh các tệp DLL bị khóa mà không yêu cầu quyền truy cập của quản trị viên, đồng thời vẫn giữ được đầu ra Pester hữu ích; issue hoàn tất khi phương pháp đó được thống nhất và được ghi lại hoặc triển khai.

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

Đánh giá

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

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.