TLDR
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.
TMI
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.
TLDR
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.
TMI
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.
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Aug 11, 2018 at 3:46 Geoffrey HaleGeoffrey Hale 11.4k5 gold badges45 silver badges49 bronze badges3 Answers
Reset to default 13TLDR
Run jest with --verbose
.
Change package.json test script to jest --verbose
.
TMI
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
.
You can run multiple tests with the --verbose
flag (as mentioned by Geoffrey Hale in his answer).
You can tell the command line to pass the flag to jest (instead of npm) with --
:
npm run test -- --verbose
You can add or set the following property in your jest configuration file (jest.config.ts or jest.config.json) to show the list of your test names and their status.
// Indicates whether each individual test should be reported during the run
verbose: true
You can read more here: https://jestjs.io/docs/configuration#verbose-boolean