Is there a way to allow the failure of specific tests but show that they are failing?
By "allow" you mean what, exactly?
Similar to allow_failures on travis:
https://docs.travis-ci.com/user/customizing-the-build#Rows-that-are-Allowed-to-Fail
https://improveandrepeat.com/2014/01/travis-ci-and-allowed-failures/
@boneskull Like jasmine, it has a "fail" function,
describe("A spec using the fail function", function() {
var foo = function(x, callBack) {
if (x) {
callBack();
}
};
it("should not call the callBack", function() {
foo(false, function() {
fail("Callback has been called");
});
});
});
Exactly!
@boneskull This section in the ava docs describes a huge benefit that comes with this: a PR with a failing test (but a failing test that doesn't break the build).
I'm currently using it.skip in a few cases where there are known bugs and we have a failing test case, but it's not a high enough priority for an immediate fix. This doesn't actually run the failing test though and doesn't differentiate between an unwritten pending test and a known failing test.
It would be great to see something like:
441 passing (509ms)
3 pending
1 expected failing
Also, I wouldn't be able to take this on immediately, but if you'd be willing to merge a PR that implemented this, I would be willing to work on this in the near future.
I am a bot that watches issues for inactivity.
This issue hasn't had any recent activity, and I'm labeling it stale. In 14 days, if there are no further comments or activity, I will close this issue.
Thanks for contributing to Mocha!
Here is a simplified workaround
it.allowFail = (title, callback) => {
it(title, function() {
return Promise.resolve().then(() => {
return callback.apply(this, arguments);
}).catch(() => {
this.skip();
});
});
};
it.allowFail('skip on error', function() {
assert.ok(false);
});
or use it here if you want.
Most helpful comment
Here is a simplified workaround
or use it here if you want.