I found the answer here
https://devhints.io/jest
test('it is raining', () => {
expect(inchesOfRain()).toBeGreaterThan(0);
});
test.skip('it is not snowing', () => {
expect(inchesOfSnow()).toBe(0);
});
Link on off doc
You can also exclude test
or describe
by prefixing them with an x
.
Individual Tests
describe('All Test in this describe will be run', () => {
xtest('Except this test- This test will not be run', () => {
expect(true).toBe(true);
});
test('This test will be run', () => {
expect(true).toBe(true);
});
});
Multiple tests inside a describe
xdescribe('All tests in this describe will be skipped', () => {
test('This test will be skipped', () => {
expect(true).toBe(true);
});
test('This test will be skipped', () => {
expect(true).toBe(true);
});
});
If you'd like to skip a test in Jest, you can use test.skip:
test.skip(name, fn)
Which is also under the following aliases:
it.skip(name, fn)
or xit(name, fn)
or xtest(name, fn)
Additionally, if you'd like to skip a test suite, you can use describe.skip:
describe.skip(name, fn)
Which is also under the following alias:
xdescribe(name, fn)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With