test_runner: better error handing for test hook#52401
test_runner: better error handing for test hook#52401nodejs-github-bot merged 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
be37e0d to
0e35b75
Compare
| </testcase> | ||
| <!-- Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. --> | ||
| <!-- Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. --> | ||
| <!-- Warning: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. --> |
There was a problem hiding this comment.
Probably should also have the replaceTestLocationLine transformer?
There was a problem hiding this comment.
I am ok with these being a number. it shouldn't change much
|
|
||
| Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. | ||
| Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. | ||
| Warning: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. |
|
|
||
| Warning: Test "unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. | ||
| Warning: Test "async unhandled rejection - passes but warns" generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. | ||
| Warning: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:72:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. |
| ]); | ||
| const stdout = child.stdout.toString(); | ||
| assert.match(stdout, /^# Warning: Test "extraneous async activity test" generated asynchronous activity after the test ended/m); | ||
| assert.match(stdout, /^# Warning: Test "extraneous async activity test" at .+extraneous_set_immediate_async\.mjs:3:1 generated asynchronous activity after the test ended/m); |
There was a problem hiding this comment.
| assert.match(stdout, /^# Warning: Test "extraneous async activity test" at .+extraneous_set_immediate_async\.mjs:3:1 generated asynchronous activity after the test ended/m); | |
| assert.match(stdout, /^# Warning: Test "extraneous async activity test" at .+extraneous_set_immediate_async\.mjs:\d+:\d+ generated asynchronous activity after the test ended/m); |
(same for rest of the file)
There was a problem hiding this comment.
I am ok with this being a number. it shouldn't change much
There was a problem hiding this comment.
We can leave col/row number here, because fixtures are won't change too much, it's good to keep it here
| msg = `Warning: ${name} at ${relPath}:${test.loc.line}:${test.loc.column} generated asynchronous ` + | ||
| 'activity after the test ended. This activity created the error ' + | ||
| `"${err}" and would have caused the test to fail, but instead ` + | ||
| `triggered an ${eventName} event.`; |
There was a problem hiding this comment.
There is another warning on line 70 that we should change to an error. We should also remove the part that says "after the test ended" since we have seen that it can happen before a test even starts.
There was a problem hiding this comment.
We should also remove the part that says "after the test ended" since we have seen that it can happen before a test even starts.
I will keep this comment because it seems out of the context of this PR. And perhaps we can open another PR and add such test case
cjihrig
left a comment
There was a problem hiding this comment.
LGTM. Thanks, I think this is a nice change.
|
@himself65 CI seems to have failures related to the snapshots |
How to fix it? |
|
see https://ci.nodejs.org/job/node-test-binary-windows-js-suites/27045/RUN_SUBSET=1,nodes=win11-COMPILED_BY-vs2022/console for example:
|
Once you fix the transfrormers @MoLow mentioned, run the following command to update the snapshots: Lines 690 to 694 in 5b33f9d |
|
working on this now |
074683d to
16f2eef
Compare
Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
16f2eef to
ebaa222
Compare
Commit Queue failed- Loading data for nodejs/node/pull/52401 ✔ Done loading data for nodejs/node/pull/52401 ----------------------------------- PR info ------------------------------------ Title test_runner: better error handing for test hook (#52401) Author Alex Yang (@himself65) Branch himself65:himself65/20240407/better-error-handler -> nodejs:main Labels needs-ci, test_runner Commits 1 - test_runner: better error handing for test hook Committers 1 - Alex Yang PR-URL: https://github.com/nodejs/node/pull/52401 Fixes: https://github.com/nodejs/node/issues/52399 Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/52401 Fixes: https://github.com/nodejs/node/issues/52399 Reviewed-By: Moshe Atlow Reviewed-By: Chemi Atlow Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last approving review: ⚠ - test_runner: better error handing for test hook ℹ This PR was created on Sun, 07 Apr 2024 07:56:26 GMT ✔ Approvals: 4 ✔ - Moshe Atlow (@MoLow) (TSC): https://github.com/nodejs/node/pull/52401#pullrequestreview-1990080998 ✔ - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/52401#pullrequestreview-1990786703 ✔ - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/52401#pullrequestreview-1990921524 ✔ - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/52401#pullrequestreview-1991730905 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2024-04-15T07:42:58Z: https://ci.nodejs.org/job/node-test-pull-request/58391/ - Querying data for job/node-test-pull-request/58391/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/8687402947 |
|
Landed in f098b7a |
Fixes: #52399