Fixing up mof compilation test script to set PSMODULEPATH properly

This commit is contained in:
John Kordich
2016-08-04 10:47:41 -07:00
parent 643533b6a8
commit e0fdf1ed00
@@ -1,13 +1,15 @@
$originalPSModulePath = $env:PSModulePath
try
{
$env:DSC_HOME = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath dsc
# $env:PSMODULEPATH = $env:PSMODULEPATH + ";" + $env:DEVPATH + "Modules"
# $env:PSModulePath = "$($env:DEVPATH)\Modules"
Describe "DSC MOF Compilation" -tags "CI" {
AfterAll {
$env:PSMODULEPATH = $_modulePath
}
BeforeAll {
$env:DSC_HOME = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath dsc
$_modulePath = $env:PSMODULEPATH
$powershellexe = (get-process -pid $PID).MainModule.FileName
$env:PSMODULEPATH = join-path ([io.path]::GetDirectoryName($powershellexe)) Modules
}
It "Should be able to compile a MOF from a basic configuration" -Skip:$IsWindows {
[Scriptblock]::Create(@"
configuration DSCTestConfig
@@ -162,8 +164,3 @@ Describe "DSC MOF Compilation" -tags "CI" {
}
}
}
finally
{
$env:PSModulePath = $originalPSModulePath
}