0

In mocha, I have a couple unit tests which use skip

it.skip('login (return photo)', function(done) { ...

However, in some cases, I want to force not skipping, like before a deployment. Is there a flag I can pass mocha to do so?

Matthew Chung
  • 1,322
  • 1
  • 19
  • 31

1 Answers1

0

.skip is provided as a way to omit a test without having to comment it out, potentially forgetting about it forever. You're probably better off conditionally registering the test yourself.

Perhaps something like this:

var isDev = process.env.NODE_ENV === 'development';

describe('stuff', function() {
  if (!isDev) {
    it('login (return photo)', function (done) { ... }
  }
});
CatDadCode
  • 58,507
  • 61
  • 212
  • 318