Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reporters' config #6542

Merged
merged 7 commits into from
Aug 16, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
regression test
- config for reporters supports `default`
  • Loading branch information
artola committed Aug 15, 2018
commit 5ebd1ce0a18f559bdd99b1abbf300a380ee2eab7
39 changes: 39 additions & 0 deletions packages/jest-cli/src/__tests__/TestScheduler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,45 @@ jest.mock('jest-runner-parallel', () => jest.fn(() => mockParallelRunner), {
virtual: true,
});

test('config for reporters supports `default`', () => {
const undefinedReportersScheduler = new TestScheduler(
{
reporters: undefined,
},
{},
);
const numberOfReporters =
undefinedReportersScheduler._dispatcher._reporters.length;

const stringDefaultReportersScheduler = new TestScheduler(
{
reporters: ['default'],
},
{},
);
expect(stringDefaultReportersScheduler._dispatcher._reporters.length).toBe(
numberOfReporters,
);

const defaultReportersScheduler = new TestScheduler(
{
reporters: [['default', {}]],
},
{},
);
expect(defaultReportersScheduler._dispatcher._reporters.length).toBe(
numberOfReporters,
);

const emptyReportersScheduler = new TestScheduler(
{
reporters: [],
},
{},
);
expect(emptyReportersScheduler._dispatcher._reporters.length).toBe(0);
});

test('.addReporter() .removeReporter()', () => {
const scheduler = new TestScheduler({}, {});
const reporter = new SummaryReporter();
Expand Down