-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
🚀 Feature Proposal
The ability to mark a test as expected to fail probably with the following syntax:
describe('Test isCool function works', {
test('jeff is the best', () => {
expect(isCool("jeff")).toBe(true);
});
test.xfail("for some reason I'm not coming out as cool...", () => {
expect(isCool("will")).toBe(true);
});
});And suggested output:
Test Suites: 1 failed, 5 passed 6 total
Tests: 1 failed, 16 passed, 2 expected failures, 2 unexpected passes, 21 total
Snapshots: 0 total
Time: 2.627s, estimated 4s
Ran all test suites.
Motivation
Many testing frameworks allow you to specify a test as a expected failure. This can be very useful for long-term TDD and for testing known-bugs are still bugs without implying that it's intended behaviour.
Example
In the above output, an engineer should be surprised (and pleased) by the 2 unexpected passes and change those tests to test from test.xfail if their commit caused the fixes. Otherwise they can leave as is for an engineer who understands those tests to mark as resolved.
Pitch
I feel this is a core feature as it's a fundamentally new result status for tests.
See some great comments from an older issue #8317
yesmeck, GytisZ, mikepqr, tchetwin, ryparker and 75 moreTuuleSoberkarlismelderis, sladyn98, jakub-trzebiatowski, RadixSeven, carlpaten-ivadolabs and 7 more