Skip to content

MSTest Failure not failing build; exit code 1 #23

toddhgardner opened this Issue Nov 4, 2011 · 1 comment

2 participants


MSTest forces the exit code of Invoke-PSake to 1 if any test fails, regardless of ContinueOnError.

If I have a script such as:

Task test -ContinueOnError {
    exec { & MSTest /testcontainer:Failing.UnitTests.dll } 

That I invoke with a batch file such as:

powershell.exe -Version 2 -NoProfile -ExecutionPolicy unrestricted -Command "& {cls; Import-Module '.\psake\psake.psm1'; invoke-psake .\test.ps1 -framework 4.0 %*; if (($lastexitcode -ne 0) -and ($lastexitcode -ne $null)) {write-host "ERROR: $lastexitcode" -fore RED; exit $lastexitcode} }" 

I get a result:

Build Succeeded!

Build Time Report
Name   Duration
----   --------
test   00:00:02.4978145
Total: 00:00:02.5227254

I have a pull request that solves this issue, will be sending shortly

@whut whut pushed a commit to whut/psake that referenced this issue Nov 4, 2011
whut Fix for issue #23 - psake.cmd should exit with 0 when build succeeded
Also use of -ExecutionPolicy Bypass, which is even less restrictive than -ExecutionPolicy Unrestricted
psake member
whut commented Nov 4, 2011

GitHub automatically created another issue, #24 when you created pull request, check comment there.

@whut whut closed this Nov 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.