Skip to main content

Statuses

Jest Allure 2 Reporter supports all the standard statuses defined by the Allure Framework.

It provides a clear indication whether your test cases have passed, failed, were broken, skipped, or whether their status is unknown.

🟒 Passed​

Status passed is reported when the test case has passed successfully:

test('passed test', () => {
expect(2 + 2).toBe(4);
});

πŸ”΄ Failed​

Status failed is reported when the test case has revealed a product defect, or it has invalid assertions:

test('failed test', () => {
expect(2 + 2).not.toBe(4);
});
tip

You can build a custom defects classification system based on test status, error messages, and stack traces.

🟑 Broken​

Status broken is reported when the test case has failed due to an error in the test code:

test('broken test', () => {
const user = null;
// TypeError: Cannot read property 'name' of null
expect(user.name).toBe('John');
});
tip

If your test assertions throw errors directly instead of using or extending Jest's expect API, they will be reported as ⁠🟑 Broken tests by default.

To report them as πŸ”΄Β Failed tests, you can use a status customizer function:

jest.config.js
module.exports = {
// ...
reporters: [
// ...
['jest-allure2-reporter', {
testCase: {
status: ({ value }) => value === 'broken' ? 'failed' : value,
},
}],
],
};

βšͺ Skipped​

Status skipped is reported when the test case has been skipped due to a test.skip or test.todo call:

test.skip('skipped test', () => {
expect(2 + 2).toBe(4);
});

test.todo('todo test');
note

There's no way to distinguish between test.skip and test.todo calls, so both will be reported as skipped.

🟣 Unknown​

Status unknown is reported when information about the test case result has been lost or not created:

test('unknown test', () => {
process.exit(0); // the test information will be unrecoverable
});
info

In the real world scenarios, this might happen if you use --bail in Jest with multiple test suites running in parallel, and one of them fails. In this case, Jest will exit immediately, and the reporter will not be able to wait for the test results from the other workers.