Skip to content

Commit 953f4f9

Browse files
committed
fix(#260): improve run.ps1 script content handling in tests
- resolve script path and load content once for efficiency - update test assertions to use loaded script content
1 parent 03e745f commit 953f4f9

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/RunQualityLoop.Tests.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
BeforeAll {
22
$script:repoRoot = Split-Path -Parent $PSScriptRoot
3-
$script:runScriptPath = Join-Path $script:repoRoot 'run.ps1'
3+
$script:runScriptPath = (Resolve-Path -LiteralPath (Join-Path $script:repoRoot 'run.ps1')).Path
4+
$script:runScriptContent = Get-Content -LiteralPath $script:runScriptPath -Raw -ErrorAction Stop
45
}
56

67
Describe 'run.ps1 quality loop' {
78
It 'runs Invoke-NovaTest and Test-NovaBuild through fresh child pwsh sessions' {
8-
$content = Get-Content -LiteralPath $script:runScriptPath -Raw
9+
$script:runScriptContent | Should -Not -BeNullOrEmpty
910

10-
$content.Contains('function Invoke-NovaFreshValidationCommand') | Should -BeTrue
11-
$content.Contains('& pwsh -NoLogo -NoProfile -Command $Command') | Should -BeTrue
12-
$content.Contains('Invoke-NovaFreshValidationCommand -Command "Import-Module ''$builtModulePath'' -Force -ErrorAction Stop; Invoke-NovaTest"') | Should -BeTrue
13-
$content.Contains('Invoke-NovaFreshValidationCommand -Command "Import-Module ''$builtModulePath'' -Force -ErrorAction Stop; Test-NovaBuild"') | Should -BeTrue
11+
$script:runScriptContent.Contains('function Invoke-NovaFreshValidationCommand') | Should -BeTrue
12+
$script:runScriptContent.Contains('& pwsh -NoLogo -NoProfile -Command $Command') | Should -BeTrue
13+
$script:runScriptContent.Contains('Invoke-NovaFreshValidationCommand -Command "Import-Module ''$builtModulePath'' -Force -ErrorAction Stop; Invoke-NovaTest"') | Should -BeTrue
14+
$script:runScriptContent.Contains('Invoke-NovaFreshValidationCommand -Command "Import-Module ''$builtModulePath'' -Force -ErrorAction Stop; Test-NovaBuild"') | Should -BeTrue
1415
}
1516
}
1617

17-

0 commit comments

Comments
 (0)