Home > Mobile >  How to mark a failing test as an expected failure?
How to mark a failing test as an expected failure?

Time:02-02

Is there any way to mark a failing test as an expected failure? I have a test that is constantly failing, but it's a known bug and the ticket for this issue has been reported a while ago.

CodePudding user response:

I would just use xit instead of it to skip the test. Above it I would add a comment with a link to the bug ticket. When it is done with xit, the test is shown as pending.

CodePudding user response:

In this scenario, it is better to skip the test which are failing.

There are two ways to skip any test or test suite.

  1. prefixing the test or it or describe with x
xdescribe(("test suite will be skipped") => {
  xtest(("this test is also skipped but don't use it with xdescribe") => {
    expect(true).toBe(true);
  })
 xit(("skip it test") => {
    expect(true).toBe(true);
  })
})
  1. skip() api of test, it or describe
describe.skip(("test suite will be skipped") => {
  test.skip(("this test is also skipped but don't use it with describe.skip") => {
    expect(true).toBe(true);
  })
 it.skip(("skip it test") => {
    expect(true).toBe(true);
  })
})
  •  Tags:  
  • Related