test_runner: display failed test stack trace with dot reporter#52655
Conversation
|
Review requested:
|
| yield '\n'; | ||
|
|
||
| if (failedTests.length > 0) { | ||
| yield `${colors.red}${failedTestSymbol} failing tests:${colors.white}\n`; |
There was a problem hiding this comment.
Use uppercase when possible
Failed tests:
There was a problem hiding this comment.
Sure, I'll keep that in mind. I assumed it should be consistent with the spec reporter, which uses "failing tests:"
There was a problem hiding this comment.
@nodejs/test_runner WDYT about the formatting?
There was a problem hiding this comment.
Should I also make it Failed tests: for spec reporter?
| } | ||
| if (type === 'test:fail') { | ||
| yield 'X'; | ||
| failedTests.push(data); |
There was a problem hiding this comment.
For the internals of Node.js, we use primordials, so try to use them when possible (ArrayPrototypePush)
|
Also, please lint your source code and commit message. (You just need to the put the change in the commit message, E.G. |
atlowChemi
left a comment
There was a problem hiding this comment.
The commit should be prefixed with the node submodule changed, which in this case is test_runner and not test (test refers to the tests used in the Nodejs CI)
Please note that you will have to regenerate the snapshots for this to work. You will have to run the following command NODE_REGENERATE_SNAPSHOTS=1 ./node test/parallel/test-runner-output.mjs see:
Lines 690 to 694 in 1681786
| yield '\n'; | ||
|
|
||
| if (failedTests.length > 0) { | ||
| yield `${colors.red}${failedTestSymbol} failing tests:${colors.white}\n`; |
There was a problem hiding this comment.
We might want to use util.styleText, though I am not sure we want to, as it could be affected from user-land
There was a problem hiding this comment.
since the issue mentioned spec reporter, I tried to match it to how it's done in spec.js. If it is required to be changed, should it only be done for dot reporter or for spec reporter as well?
There was a problem hiding this comment.
It might be worth to change it globally, but I think that’s an issue for a different PR.
| if (failedTests.length > 0) { | ||
| yield `${colors.red}${failedTestSymbol} failing tests:${colors.white}\n`; | ||
| for (const test of failedTests) { | ||
| const message = `${colors.red}${failedTestSymbol} ${test.name} ${colors.gray}(${test.details.duration_ms}ms)\n`; |
There was a problem hiding this comment.
Don't we need to reset the output color after this?
mcollina
left a comment
There was a problem hiding this comment.
Can you please add a unit test?
there are existing tests in place that need to be updated. see #52655 (review) |
avivkeller
left a comment
There was a problem hiding this comment.
A lot of the test snapshots should not have changed
|
▶ test runner output (4860.751ms) AssertionError [ERR_ASSERTION]: Unexpected global(s) found: DT_AGENT_INJECTED I get this after regenerating the snapshots, any idea what this could be about? |
|
Chances are something that your PR changed caused an issue with testing in general. Try isolating the issue (via fiddling with the REPL or tests) |
| @@ -0,0 +1,15 @@ | |||
| 'use strict' | |||
|
|
|||
| const symbols = { | |||
There was a problem hiding this comment.
I am not sure how I feel about this name 🤔
WDYT about reporterUnicodeSymbolMap etc?
There was a problem hiding this comment.
We could also export them directly, or would that be an issue with prototypes?
There was a problem hiding this comment.
It is not an issue... we need this when creating an object, not a string (so module.exports.something = '\u2176' is just fine 🤷🏽♂️
But I don't think we should export them directly, as we would want this file to have additional common code for the reporters, see #52655 (comment)
|
@mihir254 the submodule in the first commit is wrong, and in addition, the commit is 123 chars long, while the max allowed is 72. node/doc/contributing/pull-requests.md Lines 160 to 214 in 1681786 |
avivkeller
left a comment
There was a problem hiding this comment.
I'm not quite sure if I like the amount of changes this PR has introduced (I'm not sure if they are all needed), but that's just my opinion.
As for changes, the globals error in most snapshots shouldn't be there (I think). AFAIK there is not global with that name.
| throw err; | ||
| ^ | ||
|
|
||
| AssertionError [ERR_ASSERTION]: Unexpected global(s) found: __DT_AGENT_INJECTED__ |
There was a problem hiding this comment.
I'm not quite sure what this global is, but I don't think it was here before
There was a problem hiding this comment.
I perhaps did not expect so many commits to line up in the PR. Should I create a fresh PR with the latest changes?
I have changed 3 test_runner/reporter files and 2 snapshots, in total.
There was a problem hiding this comment.
I can also create 2 different PRs, one for displaying mages in dot router and other for adding a stack trace to it.
There was a problem hiding this comment.
You could rebase and squash some commits, if this is an issue (it would also allow fixing the first commit message)
| @@ -1 +1,11 @@ | |||
| .X | |||
| ✖ Failed tests: | |||
There was a problem hiding this comment.
I think there might be a space too much before Failed tests:
Also, I'm would remove the x before and add a newline after the dots.
|
@mihir254 according to the CI, there may be a merge conflict in the dot reporter |
MoLow
left a comment
There was a problem hiding this comment.
LGTM. the fix indeed made the tests pass - the failures are unrelated
Commit Queue failed- Loading data for nodejs/node/pull/52655 ✔ Done loading data for nodejs/node/pull/52655 ----------------------------------- PR info ------------------------------------ Title test_runner: display failed test stack trace with dot reporter (#52655) Author Mihir Bhansali (@mihir254, first-time contributor) Branch mihir254:modifying-dot-reporter -> nodejs:main Labels author ready, needs-ci, commit-queue-squash, test_runner Commits 6 - test_runner: dot reporter displays failed test names - lint - fix tests - test_runner: fix assertions in dot-reporter tests - fixed indentation and lint errors - test_runner: reporterColorMap changed to map functions Committers 1 - Mihir Bhansali PR-URL: https://github.com/nodejs/node/pull/52655 Fixes: https://github.com/nodejs/node/issues/51769 Reviewed-By: Matteo Collina Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/52655 Fixes: https://github.com/nodejs/node/issues/51769 Reviewed-By: Matteo Collina Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 23 Apr 2024 17:23:18 GMT ✔ Approvals: 3 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/52655#pullrequestreview-2042141691 ✔ - Moshe Atlow (@MoLow) (TSC): https://github.com/nodejs/node/pull/52655#pullrequestreview-2042377524 ✔ - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/52655#pullrequestreview-2031600698 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2024-05-07T08:03:44Z: https://ci.nodejs.org/job/node-test-pull-request/59007/ - Querying data for job/node-test-pull-request/59007/ ✔ Last Jenkins CI successful ⚠ PR author is a new contributor: @mihir254([email protected]) ⚠ - commit 18eeb02527f3 is authored by [email protected] ⚠ - commit 748da16cb019 is authored by [email protected] -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/8983972314 |
PR-URL: nodejs#52655 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
c295eaf to
69f2ace
Compare
|
Landed in 69f2ace |
|
Thanks for the contribution @mihir254 🎉 |
Add failed test names and stack trace to dot reporter output
Fixes: #51769