In a Jenkins job, I have a windows batch Command build step, which runs a test with phantomJS, like this:

How can I make the job fail, if inside smokeTest.js I exit phantom with an error, like this:
phantomJS.exit(1)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Jenkins considers a job as “failed” if the return-code of any command-block
(like that ‘ExecuteWindows batch command’ above) is non-zero.
If it does not work for you in this case, it is probably because ‘phantomjs.exe’ returns ‘0’ in any case
(can confirm this by echo-ing the ERRORLEVEL just after that command:
ECHO %ERRORLEVEL%).If this is the case (i.e.: it returns ‘0’ even when fails), you can handle it this way: