gaelcolas / gaelcolas/SampleModule

Pester and DLL locking

オープン
#16 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PowerShell
スター
43
フォーク
8
PR マージ指標
30日以内にマージされた PR はありません

説明

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
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Issue に示されている Indented.Build モジュールのテスト呼び出しから始めます。Invoke-Pester、Invoke-Command、および Start-Process の代替手段を含みます。管理者アクセスを必要とせず、Pester の有用な出力を維持したまま、開発ビルドを繰り返しても DLL ファイルがロックされないようにする方法を確認します。そのアプローチについて合意し、文書化または実装できた時点で Issue は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
powershell
領域
build-system, testing
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。