chore: 记录改造前基线

改造开始前的完整状态,作为可回退的基点。此提交之后:Pester 175 项、零依赖套件 101 项全绿;PowerShell 5.1 尚不可用(源文件无 BOM)。

包含此前未提交的在制品:安全描述符套件、Hyper-V 实验环境(tools/lab)、agent 约定(AGENTS.md 与 docs/agents)。

.gitignore 增加 *.key / *.pfx:BackupConfig.psd1 的 PasswordFile 此前默认指向仓库内的 baknret.key,一次 git add -A 就会把口令提交进版本库。默认值在后续提交中改为空。
This commit is contained in:
Shuery committed 2026-09-26 21:46:55 +08:00
1 parent 7173e8ae10
commit 2937eb6652
32 files changed
+8775 -1691

No files matched your search

+17 -2
View File
@@ -74,11 +74,26 @@ $configuration.Run.Exit = $false
$configuration.Output.Verbosity = $Verbosity
if ($Tag) { $configuration.Filter.Tag = $Tag }
# 关掉 Pester 的 TestRegistry:它会去写注册表(HKCU 下的测试键),
# 在受限环境 / 沙箱里会被拒绝,于是**所有**容器都以
# "Was not able to registry key for TestRegistry" 失败。
# 本套件不用 TestRegistry(只用临时目录),关掉它不影响任何用例。
$configuration.TestRegistry.Enabled = $false
$result = Invoke-Pester -Configuration $configuration
# 容器级失败(发现阶段的语法错误、Describe 外的异常)不会进 FailedCount,
# 只会在输出里出现一行 "Container failed" —— 不显式检查就会把"根本没跑起来"
# 报成"全部通过"。这里把它也当成失败。
$failedContainers = @($result.Containers | Where-Object { $_.Result -eq 'Failed' })
Write-Host ''
if ($result.FailedCount -gt 0) {
Write-Host ("Pester 测试通过 {0} 项,失败 {1} 项,跳过 {2} 项" -f $result.PassedCount, $result.FailedCount, $result.SkippedCount) -ForegroundColor Red
if ($result.FailedCount -gt 0 -or $failedContainers.Count -gt 0) {
Write-Host ("Pester 测试通过 {0} 项,失败 {1} 项,跳过 {2} 项,容器级失败 {3} 个" -f `
$result.PassedCount, $result.FailedCount, $result.SkippedCount, $failedContainers.Count) -ForegroundColor Red
foreach ($container in $failedContainers) {
Write-Host (" 容器失败:{0}" -f $container.Item) -ForegroundColor Red
}
exit 1
}