help - "testless build" if test fails
andreabisello opened this issue · 2 comments
if test fails, atlassian bamboo thinks there is no test in the run.
if all the test pass,
bamboo gives me test results
if one test fails,
atlassian think there is no test
i think the solution is there https://github.com/hendrikdp/bamboo-jest-reporter#usage but i'm not able to understand.
can you explain me better?
thanks
This is because the 'npm test' task in your job failed... If one task in your job fails, it won't execute the next one (meaning that the 'mocha parser' task will be skipped). To prevent your job from failing on 'npm test', you should send exit code 0 ('exit 0') in your bamboo task...
In your job:
- add task
- select script
- interpreter: bin/sh (bash)
In the script test if 'npm test' fails, if it does exit your job with 'exit 0'
if ! npm test
then
echo "The automated jest tests did not pass. Please check the tests-tab"
exit 0
fi
Hope this helps!
Kind rgds,
Hendrik
another way on windows is using testFailureExitCode 0
jest --config ${bamboo.build.working.directory}/jest.config.js --rootDir ${bamboo.build.working.directory} --runInBand --testFailureExitCode 0