From 1d047b5f140c71774453b4b2de57baaeb2850ca1 Mon Sep 17 00:00:00 2001 From: KevinMarquette Date: Sun, 5 Feb 2017 01:19:55 -0800 Subject: [PATCH] Fixed unit testissue with build ssytem --- Tests/Unit.Tests.ps1 | 4 +++- psake.ps1 | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/Unit.Tests.ps1 b/Tests/Unit.Tests.ps1 index 3f91f90..3d2b475 100644 --- a/Tests/Unit.Tests.ps1 +++ b/Tests/Unit.Tests.ps1 @@ -61,8 +61,10 @@ Describe "Basic unit tests" -Tags Build { } it "SetScript()" { + pushd $projectRoot $monitor = [MonitoredScript]::New() - {$monitor.SetScript("$projectRoot\scratchfiles\example.ps1")} | Should Not Throw + {$monitor.SetScript(".\scratchfiles\example.ps1")} | Should Not Throw + popd } } diff --git a/psake.ps1 b/psake.ps1 index b51af94..cf732c6 100644 --- a/psake.ps1 +++ b/psake.ps1 @@ -33,7 +33,7 @@ Task Init { Task UnitTests -Depends Init { $lines 'Running quick unit tests to fail early if there is an error' - $TestResults = Invoke-Pester -Path $ProjectRoot\Tests\*unit* -PassThru -Tag Build -Show Failed + $TestResults = Invoke-Pester -Path $ProjectRoot\Tests\*unit* -PassThru -Tag Build if($TestResults.FailedCount -gt 0) { @@ -47,7 +47,7 @@ Task Test -Depends UnitTests { "`n`tSTATUS: Testing with PowerShell $PSVersion" # Gather test results. Store them in a variable and file - $TestResults = Invoke-Pester -Path $ProjectRoot\Tests -PassThru -OutputFormat NUnitXml -OutputFile "$ProjectRoot\$TestFile" -Tag Build -Show Failed + $TestResults = Invoke-Pester -Path $ProjectRoot\Tests -PassThru -OutputFormat NUnitXml -OutputFile "$ProjectRoot\$TestFile" -Tag Build # In Appveyor? Upload our tests! #Abstract this into a function? If($ENV:BHBuildSystem -eq 'AppVeyor')