Setting exit code to Powershell script does not work

Alex Tercete's Avatar

Alex Tercete

18 Jul, 2014 10:57 PM

I am using Pester to run unit tests for a few Powershell scripts. I've set up the test script in AppVeyor to be:

Invoke-Pester -EnableExit

It runs correctly, but when any test fails, the build still succeeds.

It seems that Pester uses $host.SetShouldExit() to set the exit code. Was AppVeyor supposed to work with this?

  1. Support Staff 1 Posted by Feodor Fitsner on 19 Jul, 2014 05:39 AM

    Feodor Fitsner's Avatar

    Hi Alex,

    It's not currently implemented, but I'll look into that.

  2. Support Staff 2 Posted by Feodor Fitsner on 19 Jul, 2014 03:20 PM

    Feodor Fitsner's Avatar

    We've just deployed an update implementing that. Give it another try and let me know how it goes.

  3. 3 Posted by Alex Tercete on 21 Jul, 2014 10:51 AM

    Alex Tercete's Avatar

    Hey Feodor, thanks for the quick fix. However, it does not appear to have worked. The build is still green, even though there are failed tests. I have even tried to call $host.SetShouldExit(1) myself to make sure it was not anything related to Pester.

  4. Support Staff 4 Posted by Feodor Fitsner on 21 Jul, 2014 03:22 PM

    Feodor Fitsner's Avatar

    Will take a look.

  5. Support Staff 5 Posted by Feodor Fitsner on 22 Jul, 2014 06:50 AM

    Feodor Fitsner's Avatar

    OK, found the issue, fixed and deployed update.

  6. 6 Posted by Alex Tercete on 22 Jul, 2014 11:57 AM

    Alex Tercete's Avatar

    It works! Thanks!

    Keep up the great work!

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:46 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

21 Aug, 2019 11:06 PM
21 Aug, 2019 02:08 PM
21 Aug, 2019 01:37 PM
21 Aug, 2019 10:21 AM
21 Aug, 2019 09:10 AM

 

21 Aug, 2019 05:56 AM
21 Aug, 2019 03:08 AM
20 Aug, 2019 11:33 PM
20 Aug, 2019 08:07 PM
20 Aug, 2019 05:50 PM
20 Aug, 2019 12:35 PM