When running Jest (23.5.0) with only one file, it outputs 'describe names' and 'test names'. I want Jest to output 'describe names' and 'test names' when running with multiple test files, but it seems to be automatically suppressing.
Example:
PASS src/components/UsersTable.test.jsx
UsersTable
✓ is a table (4ms)
✓ has columns 'first', 'last', 'email' (1ms)
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 1.768s, estimated 2s
Ran all test suites.
When running with two, it suppresses. Example:
PASS src/components/UsersTableRow.test.jsx
PASS src/components/UsersTable.test.jsx
Test Suites: 2 passed, 2 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: 2.254s
Ran all test suites.
Partial code sample:
describe('UsersTable', () => {
const component = renderer.create(
<UsersTable />
);
const usersTable = component.toJSON();
test('is a table', () => {
expect(usersTable.type).toBe('table');
});
Removing 'test' from the name of either file such that only one of the two tests runs at a time, results in successful desired output of name details for either file. TLDR: Both files work alone.
Run jest with --verbose
.
Change package.json test script to jest --verbose
.
I tried npm run test --verbose
which affected the output but didn't include the information I was hoping for. I mistakenly thought that --verbose
wasn't the fix. But in npm run test --verbose
, I'm mistakenly applying the verbose flag to the npm process, not to jest.
Apparently jest
is the same as jest --verbose
if only a single test file exists, but not for two or more. For two or more, must explicitly include --verbose
.
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