Consider the following test:
describe( "file system", () => {
it( "should check if the file exists", async () => {
const received = await fileExists();
const expected = true;
expect( received ).toBe( expected );
});
});
When fileExists
rejects, an UnhandledPromiseRejectionWarning
is received as expected. But this does not help trace the source of the failed test.
For synchronous tests, Jest shows the path to the test (i.e. file system › should check if the file exists
) which helps trace the source of the failed test.
What is the best way to achieve this for asynchronous tests?
Aucun commentaire:
Enregistrer un commentaire