Skip to content

Commit

Permalink
Initialize reporters early in the process
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronabramov committed Sep 14, 2017
1 parent c4844a6 commit e226fb8
Show file tree
Hide file tree
Showing 26 changed files with 609 additions and 537 deletions.
27 changes: 16 additions & 11 deletions integration_tests/__tests__/__snapshots__/console.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`console printing 1`] = `
"PASS __tests__/console.test.js
● Console
" console.log __tests__/console.test.js:11
This is a log message.
console.log __tests__/console.test.js:11
This is a log message.
console.info __tests__/console.test.js:13
This is an info message.
console.warn __tests__/console.test.js:15
This is a warning message.
console.error __tests__/console.test.js:17
This is an error message.
console.info __tests__/console.test.js:13
This is an info message.
console.warn __tests__/console.test.js:15
This is a warning message.
console.error __tests__/console.test.js:17
This is an error message.
"
`;

exports[`console printing 2`] = `
"PASS __tests__/console.test.js
✓ works just fine
"
`;

exports[`console printing 3`] = `
"Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Expand Down Expand Up @@ -45,7 +51,6 @@ exports[`console printing with --verbose 1`] = `
exports[`console printing with --verbose 2`] = `
"PASS __tests__/console.test.js
✓ works just fine
"
`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,78 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Custom Reporters Integration IncompleteReporter for flexibility 1`] = `
exports[`IncompleteReporter for flexibility 1`] = `
"onRunComplete is called
Passed Tests: 1
Failed Tests: 0
Total Tests: 1
"
`;

exports[`Custom Reporters Integration TestReporter with all tests failing 1`] = `
Object {
"onRunComplete": Object {
"called": true,
"numFailedTests": 1,
"numPassedTests": 0,
"numTotalTests": 1,
},
"onRunStart": Object {
"called": true,
"options": "object",
},
"onTestResult": Object {
"called": true,
"times": 1,
},
"onTestStart": Object {
"called": true,
"path": false,
},
"options": Object {
"christoph": "pojer",
"dmitrii": "abramov",
"hello": "world",
},
}
`;

exports[`Custom Reporters Integration TestReporter with all tests passing 1`] = `
Object {
"onRunComplete": Object {
"called": true,
"numFailedTests": 0,
"numPassedTests": 1,
"numTotalTests": 1,
},
"onRunStart": Object {
"called": true,
"options": "object",
},
"onTestResult": Object {
"called": true,
"times": 1,
},
"onTestStart": Object {
"called": true,
"path": false,
},
"options": Object {
"christoph": "pojer",
"dmitrii": "abramov",
"hello": "world",
},
}
`;

exports[`Custom Reporters Integration default reporters enabled 1`] = `
exports[`default reporters enabled 1`] = `
"PASS __tests__/add.test.js
Custom Reporters
✓ adds ok
"
`;

exports[`Custom Reporters Integration default reporters enabled 2`] = `
exports[`default reporters enabled 2`] = `
"Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Expand All @@ -81,7 +25,7 @@ Ran all test suites matching /add.test.js/i.
"
`;
exports[`Custom Reporters Integration default reporters enabled 3`] = `
exports[`default reporters enabled 3`] = `
Object {
"onRunComplete": Object {
"called": true,
Expand All @@ -105,7 +49,7 @@ Object {
}
`;
exports[`Custom Reporters Integration invalid format for adding reporters 1`] = `
exports[`invalid format for adding reporters 1`] = `
"● Reporter Validation Error:
Unexpected value for Path at index 0 of reporter at index 0
Expand All @@ -124,7 +68,7 @@ exports[`Custom Reporters Integration invalid format for adding reporters 1`] =
"
`;
exports[`Custom Reporters Integration valid array format for adding reporters 1`] = `
exports[`valid array format for adding reporters 1`] = `
"{
\\"onRunComplete\\": {
\\"called\\": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,5 @@ exports[`works with node assert 1`] = `
✕ assert.ifError
✕ assert.doesNotThrow
✕ assert.throws
"
`;
3 changes: 2 additions & 1 deletion integration_tests/__tests__/console.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ const runJest = require('../runJest');
skipOnWindows.suite();

test('console printing', () => {
const {stderr, status} = runJest('console');
const {stderr, stdout, status} = runJest('console');
const {summary, rest} = extractSummary(stderr);

expect(stdout).toMatchSnapshot();
expect(status).toBe(0);
expect(rest).toMatchSnapshot();
expect(summary).toMatchSnapshot();
Expand Down
Loading

0 comments on commit e226fb8

Please sign in to comment.