Meteor-Community-Packages / meteor-mocha

A Mocha test driver package for Meteor 1.3+. This package reports server AND client test results in the server console and can be used for running tests on a CI server or locally.
https://packosphere.com/meteortesting/mocha
MIT License
67 stars 40 forks source link

Exit Code !== 0 #79

Closed thebarty closed 6 years ago

thebarty commented 6 years ago

Hi guys,

the testrunner runs, BUT after it is done the command exits with an error-exit-code (!==0) and stops my Gitlab skript.

Any idea what might cause the command to exit with an error code?

SERVER_TEST_REPORTER=xunit XUNIT_FILE=$PWD/unit-integrationa-results.xml meteor test --once --driver-package meteortesting:mocha --allow-superuser
ERROR: Job failed: exit code 1
SimonSimCity commented 6 years ago

Can you reproduce this on your local machine when running this test command and running echo $? after it? Just in case you have a linux or mac close by 😉

I wasn't able to reproduce this behavior on my mac. To me it only returned a non-zero exit-code if there actually were tests failing.

Please also provide the output you get when calling the meteor test command.

thebarty commented 6 years ago

@SimonSimCity yes, you were right. It exists with a non-zero, if a test fails.

I wanted to continue with my acceptance tests and this is my solution: SERVER_TEST_REPORTER=xunit XUNIT_FILE=$PWD/test-results-unit-integrational.xml meteor test --once --driver-package meteortesting:mocha --settings settings-unittests-ci.json --allow-superuser || true # prevent failing mocha-tests to result in exit 1 (which would exit Gitlab). Always continue with acceptance-tests

SimonSimCity commented 6 years ago

Just for interest ... why do you want this hack? You want a CI to fail if the tests fail, right?

Hint: If you want a couple of commands to run through and to let it fail if either one failed, this could help:


meteor test || CRASHED=1
meteor test --full-app || CRASHED=1
if [ "$CRASHED" ]; then exit 1; fi