@@ -17,15 +17,23 @@ Describe "Configuration file locations" -tags "CI","Slow" {
17
17
{
18
18
$ProductName = " PowerShell"
19
19
}
20
- $expectedCache = [IO.Path ]::Combine($env: LOCALAPPDATA , " Microsoft" , " Windows" , " PowerShell" , " StartupProfileData-NonInteractive" )
21
- $expectedModule = [IO.Path ]::Combine($env: USERPROFILE , " Documents" , $ProductName , " Modules" )
22
- $expectedProfile = [IO.Path ]::Combine($env: USERPROFILE , " Documents" , $ProductName , $profileName )
23
- $expectedReadline = [IO.Path ]::Combine($env: AppData , " Microsoft" , " Windows" , " PowerShell" , " PSReadline" , " ConsoleHost_history.txt" )
20
+ $expectedCache = [IO.Path ]::Combine($env: LOCALAPPDATA , " Microsoft" , " Windows" , " PowerShell" , " StartupProfileData-NonInteractive" )
21
+ $expectedModule = [IO.Path ]::Combine($env: USERPROFILE , " Documents" , $ProductName , " Modules" )
22
+ $expectedAllUsersProfile = [IO.Path ]::Combine($PSHOME , $profileName )
23
+ $expectedCurrentUserProfile = [IO.Path ]::Combine($env: USERPROFILE , " Documents" , $ProductName , $profileName )
24
+ $expectedReadline = [IO.Path ]::Combine($env: AppData , " Microsoft" , " Windows" , " PowerShell" , " PSReadline" , " ConsoleHost_history.txt" )
24
25
} else {
25
- $expectedCache = [IO.Path ]::Combine($env: HOME , " .cache" , " powershell" , " StartupProfileData-NonInteractive" )
26
- $expectedModule = [IO.Path ]::Combine($env: HOME , " .local" , " share" , " powershell" , " Modules" )
27
- $expectedProfile = [IO.Path ]::Combine($env: HOME , " .config" , " powershell" , $profileName )
28
- $expectedReadline = [IO.Path ]::Combine($env: HOME , " .local" , " share" , " powershell" , " PSReadLine" , " ConsoleHost_history.txt" )
26
+ if ($IsMacOS ) {
27
+ $PowershellConfigRoot = " /Library/Application Support/PowerShell"
28
+ } else {
29
+ $PowershellConfigRoot = " /etc/opt/powershell"
30
+ }
31
+
32
+ $expectedCache = [IO.Path ]::Combine($env: HOME , " .cache" , " powershell" , " StartupProfileData-NonInteractive" )
33
+ $expectedModule = [IO.Path ]::Combine($env: HOME , " .local" , " share" , " powershell" , " Modules" )
34
+ $expectedAllUsersProfile = [IO.Path ]::Combine($PowershellConfigRoot , $profileName )
35
+ $expectedCurrentUserProfile = [IO.Path ]::Combine($env: HOME , " .config" , " powershell" , $profileName )
36
+ $expectedReadline = [IO.Path ]::Combine($env: HOME , " .local" , " share" , " powershell" , " PSReadLine" , " ConsoleHost_history.txt" )
29
37
}
30
38
31
39
$ItArgs = @ {}
@@ -39,8 +47,17 @@ Describe "Configuration file locations" -tags "CI","Slow" {
39
47
$env: PSModulePath = $original_PSModulePath
40
48
}
41
49
42
- It @ItArgs " Profile location should be correct" {
43
- & $powershell - noprofile - c `$ PROFILE | Should - Be $expectedProfile
50
+ It @ItArgs " Current User Profile location should be correct" {
51
+ & $powershell - noprofile - c `$ PROFILE | Should - Be $expectedCurrentUserProfile
52
+ }
53
+
54
+ It @ItArgs " All Users Profile location should be correct" {
55
+ & $powershell - noprofile - c `$ PROFILE.AllUsersAllHosts | Should - Be $expectedAllUsersProfile
56
+ }
57
+
58
+ It @ItArgs " All Users Profile location should be correct" {
59
+ $env: POWERSHELL_COMMON_APPLICATION_DATA = Join-Path - Path $PSHOME - ChildPath $profileName
60
+ & $powershell - noprofile - c `$ PROFILE.AllUsersAllHosts | Should - Be $env: POWERSHELL_COMMON_APPLICATION_DATA
44
61
}
45
62
46
63
It @ItArgs " PSModulePath should contain the correct path" {
0 commit comments