Stop testing from launching mocha

So, I have code in before()that runs before any tests. Is there a way in the function to stop the mocha from running any tests?

before(function() {
  if(someCondition === true) {
    //kill mocha before it executes any tests
  }
});

Is this possible?

+4
source share
1 answer

You can call the callback donewith an error:

before(function(done) {
  if(someCondition === true) {
    return done('Error');
  }
});
+5
source

Source: https://habr.com/ru/post/1545488/


All Articles