August 2017
Beginner
374 pages
10h 41m
English
We have already learned that tests in Jest are written via the test function:
// example.test.jstest('example test', () => expect(1 + 1).toBe(2))
Tests are grouped by putting them into separate files. However, we can also group tests within a file using the describe function:
// example.test.jsdescribe('number tests', () => { test('example test', () => expect(1 + 1).toBe(2) )})
If a test is failing, one of the first things you should do is check if the test still fails when it is the only test that runs. For this case, Jest provides a way to only run one test: test.only. All you need to do is temporarily rename the test function to test.only:
test.only('example test', () => expect(1 + 1).toBe(2))
If the test does not ...
Read now
Unlock full access