Repository navigation
test_runner: incorrect unwrapping of errors in after() when using the tap reporter #48941
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
Activity
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
on Jul 27, 2023 - changed the title
[-]test: wrong unwrapping of errors in after() when using the --test flag[/-][+]test_runner: wrong unwrapping of errors in after() when using the --test flag[/+]on Jul 27, 2023 - changed the title
[-]test_runner: wrong unwrapping of errors in after() when using the --test flag[/-][+]test_runner: incorrect unwrapping of errors in after() when using the --test flag[/+]on Jul 27, 2023 Closing. I was using v18.16.1 and in v18.17.0 is fixed.
Actually it's a problem, updating the report.
This appears to be a bug with the TAP reporter.
- changed the title
[-]test_runner: incorrect unwrapping of errors in after() when using the --test flag[/-][+]test_runner: incorrect unwrapping of errors in after() when using the tap reporter[/+]on Jul 27, 2023 This seems to fix it:
diff --git a/lib/internal/test_runner/reporter/tap.js b/lib/internal/test_runner/reporter/tap.js index 4aec4ba072..e22c647669 100644 --- a/lib/internal/test_runner/reporter/tap.js +++ b/lib/internal/test_runner/reporter/tap.js @@ -198,15 +198,14 @@ function jsToYaml(indent, name, value, seen) { errStack = cause?.stack ?? errStack; errCode = cause?.code ?? errCode; errName = cause?.name ?? errName; + errMsg = cause?.message ?? errMsg; + if (isAssertionLike(cause)) { errExpected = cause.expected; errActual = cause.actual; errOperator = cause.operator ?? errOperator; errIsAssertion = true; } - if (failureType === kTestCodeFailure) { - errMsg = cause?.message ?? errMsg; - } } result += jsToYaml(indent, 'error', errMsg, seen);
- added a commit that references this issue
on Jul 27, 2023 Proposed fix in #48942
- added a commit that references this issue
on Jul 29, 2023 - added 2 commits that reference this issue
on Aug 14, 2023 - added a commit that references this issue
on Aug 14, 2023 - added a commit that references this issue
on Nov 27, 2023 - added 2 commits that reference this issue
on Apr 25, 2024
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Consider this test:
If I run it normally, I get:
If I run in a non-interactive process such as
node --test bug.js | less, I get the error detail scrambled:This shows specifically during CI runs, where the pretty reporter is not engaged.