Skip to content

Commit

Permalink
Upgrade tests in test\powershell\Host folder to PesterV4 syntax (#6250)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergmeister authored and daxian-dbw committed Mar 23, 2018
1 parent acb52b3 commit e86fea6
Show file tree
Hide file tree
Showing 7 changed files with 292 additions and 293 deletions.
18 changes: 9 additions & 9 deletions test/powershell/Host/Base-Directory.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@ Describe "Configuration file locations" -tags "CI","Slow" {
}

It @ItArgs "Profile location should be correct" {
& $powershell -noprofile -c `$PROFILE | Should Be $expectedProfile
& $powershell -noprofile -c `$PROFILE | Should -Be $expectedProfile
}

It @ItArgs "PSModulePath should contain the correct path" {
$env:PSModulePath = ""
$actual = & $powershell -noprofile -c `$env:PSModulePath
$actual | Should Match ([regex]::Escape($expectedModule))
$actual | Should -Match ([regex]::Escape($expectedModule))
}

It @ItArgs "PSReadLine history save location should be correct" {
& $powershell -noprofile { (Get-PSReadlineOption).HistorySavePath } | Should Be $expectedReadline
& $powershell -noprofile { (Get-PSReadlineOption).HistorySavePath } | Should -Be $expectedReadline
}

# This feature (and thus test) has been disabled because of the AssemblyLoadContext scenario
It "JIT cache should be created correctly" -Skip {
Remove-Item -ErrorAction SilentlyContinue $expectedCache
& $powershell -noprofile { exit }
$expectedCache | Should Exist
$expectedCache | Should -Exist
}

# The ModuleAnalysisCache cannot be forced to exist, thus we cannot test it
Expand Down Expand Up @@ -90,21 +90,21 @@ Describe "Configuration file locations" -tags "CI","Slow" {
It @ItArgs "Profile should respect XDG_CONFIG_HOME" {
$env:XDG_CONFIG_HOME = $TestDrive
$expected = [IO.Path]::Combine($TestDrive, "powershell", $profileName)
& $powershell -noprofile -c `$PROFILE | Should Be $expected
& $powershell -noprofile -c `$PROFILE | Should -Be $expected
}

It @ItArgs "PSModulePath should respect XDG_DATA_HOME" {
$env:PSModulePath = ""
$env:XDG_DATA_HOME = $TestDrive
$expected = [IO.Path]::Combine($TestDrive, "powershell", "Modules")
$actual = & $powershell -noprofile -c `$env:PSModulePath
$actual | Should Match $expected
$actual | Should -Match $expected
}

It @ItArgs "PSReadLine history should respect XDG_DATA_HOME" {
$env:XDG_DATA_HOME = $TestDrive
$expected = [IO.Path]::Combine($TestDrive, "powershell", "PSReadLine", "ConsoleHost_history.txt")
& $powershell -noprofile { (Get-PSReadlineOption).HistorySavePath } | Should Be $expected
& $powershell -noprofile { (Get-PSReadlineOption).HistorySavePath } | Should -Be $expected
}

# This feature (and thus test) has been disabled because of the AssemblyLoadContext scenario
Expand All @@ -113,7 +113,7 @@ Describe "Configuration file locations" -tags "CI","Slow" {
$expected = [IO.Path]::Combine($TestDrive, "powershell", "StartupProfileData-NonInteractive")
Remove-Item -ErrorAction SilentlyContinue $expected
& $powershell -noprofile { exit }
$expected | Should Exist
$expected | Should -Exist
}
}
}
Expand All @@ -137,6 +137,6 @@ Describe "Working directory on startup" -Tag "CI" {
} else {
$expectedPath = $testPath.FullName
}
& $powershell -noprofile -c { $PWD.Path } | Should BeExactly $expectedPath
& $powershell -noprofile -c { $PWD.Path } | Should -BeExactly $expectedPath
}
}

0 comments on commit e86fea6

Please sign in to comment.