test_runner: report failing tests after summary#47164
test_runner: report failing tests after summary#47164nodejs-github-bot merged 2 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
lib/internal/test_runner/test.js
Outdated
| this.reporter.coverage(this.nesting, kFilename, this.harness.coverage); | ||
| } | ||
|
|
||
| this.reporter.endOfTests(); |
|
thanks for your contribution! I have left some comments |
98fa308 to
abd6ef9
Compare
|
I've addressed the comments. Thanks for the feedbacks, I learned a few things! 😄 And I found a minor issue, if Shall we fix it in this PR? Or it is better to open another PR to address this specific issue? |
better to fix in a seperate PR |
62f9aa5 to
55a4b28
Compare
MoLow
left a comment
There was a problem hiding this comment.
LGTM, bet there seems to be lint issues
| color = gray; | ||
| symbol = symbols['hyphen:minus']; | ||
| } | ||
| return `${prefix}${indent}${color}${symbol}${title}${error}${white}`; |
There was a problem hiding this comment.
| return `${prefix}${indent}${color}${symbol}${title}${error}${white}`; | |
| return `${prefix}${indent}${color}${symbol}${title}${white}${error}`; |
this is the fix for #47164 (comment)
since it is a small fix, I think it would be ok to include it in this PR
There was a problem hiding this comment.
Shall we add a test for this as well? In test/pseudo-tty/test_runner_default_reporter.out.
test('parent', () => {
test('should fail', () => { throw new Error('fail'); });
test('should pass but parent fail', () => {});
});55a4b28 to
0b7bf9a
Compare
Re-output failing tests after summary has been printed. This behavior follows other popular test runners (e.g. jest, mocha, etc...). Updated SpecReporter: 1. When there is a 'test:fail' event, the test will be stored. 2. After no more input, all the failed tests will be flushed. 3. Extract the logic for formatting a test report into a re-usable function. Fixes: nodejs#47110
0b7bf9a to
c22d1e9
Compare
|
| [90m at *[39m | ||
| [90m at *[39m | ||
|
|
||
| [31m✖ should pass but parent fail [90m(*ms)[39m[39m |
There was a problem hiding this comment.
| [31m✖ should pass but parent fail [90m(*ms)[39m[39m | |
| [31m* should pass but parent fail [90m(*ms)[39m[39m |
There was a problem hiding this comment.
Ah...
Thanks for catching this, I totally missed it. 😨
Let me verify again.
Upon 'test:fail', text color is not reset correctly if duration is not printed.
c22d1e9 to
c4fd2c7
Compare
|
Landed in 2e8f8eb |
Re-output failing tests after summary has been printed. This behavior follows other popular test runners (e.g. jest, mocha, etc...). Updated SpecReporter: 1. When there is a 'test:fail' event, the test will be stored. 2. After no more input, all the failed tests will be flushed. 3. Extract the logic for formatting a test report into a re-usable function. Fixes: #47110 PR-URL: #47164 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Re-output failing tests after summary has been printed. This behavior follows other popular test runners (e.g. jest, mocha, etc...). Updated SpecReporter: 1. When there is a 'test:fail' event, the test will be stored. 2. After no more input, all the failed tests will be flushed. 3. Extract the logic for formatting a test report into a re-usable function. Fixes: #47110 PR-URL: #47164 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Re-output failing tests after summary has been printed. This behavior follows other popular test runners (e.g. jest, mocha, etc...). Updated SpecReporter: 1. When there is a 'test:fail' event, the test will be stored. 2. After no more input, all the failed tests will be flushed. 3. Extract the logic for formatting a test report into a re-usable function. Fixes: #47110 PR-URL: #47164 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: nodejs#47164
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: #47164 PR-URL: #52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: nodejs#47164 PR-URL: nodejs#52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: nodejs#52185 Refs: nodejs#47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: nodejs#47164 PR-URL: nodejs#52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: nodejs#52185 Refs: nodejs#47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: #47164 PR-URL: #52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: #47164 PR-URL: #52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>

Re-output failing tests after summary has been printed. This behavior follows other popular test runners (e.g. jest, mocha, etc...).
Updated SpecReporter:
Fixes: #47110