I have a code where certain tests will always fail in CI environment. I would like to disable them based on an environment condition.
How to programmatically skip a
I use runtime skipping from Mocha for the same scenario as you're describing. It is the copy paste from the docs:
it('should only test in the correct environment', function() {
if (/* check test environment */) return this.skip();
// make assertions
});
As you can see, it skips the test based on environment. My own condition is if(process.env.NODE_ENV === 'continuous-integration').