Categories
JavaScript Answers

How to skip one test in test file Jest and JavaScript?

Spread the love

Sometimes, we want to skip one test in test file Jest and JavaScript.

In this article, we’ll look at how to skip one test in test file Jest and JavaScript.

How to skip one test in test file Jest and JavaScript?

To skip one test in test file Jest and JavaScript, we can use the skip method.

For instance, we write

test("it is raining", () => {
  expect(inchesOfRain()).toBeGreaterThan(0);
});

test.skip("it is not snowing", () => {
  expect(inchesOfSnow()).toBe(0);
});

to call test.skip to skip the 2nd test.

The first test will be run.

Conclusion

To skip one test in test file Jest and JavaScript, we can use the skip method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *