MoLow / reporters

A collection of reporters for `node:test`
MIT License
43 stars 3 forks source link

mocha reporter should unwrap ERR_TEST_FAILURE #124

Closed cjihrig closed 1 week ago

cjihrig commented 1 month ago

A failing test is currently displayed like this:

     Error [ERR_TEST_FAILURE]: should be a number: expected 'hello' to be a number
      at async Promise.all (index 0)
     Caused by: AssertionError: should be a number: expected 'hello' to be a number
      at TestContext.<anonymous>
      at Test.runInAsyncScope (node:async_hooks:206:9)
      at Test.run (node:internal/test_runner/test:865:25)
      at Suite.processPendingSubtests (node:internal/test_runner/test:574:18)
      at Test.postRun (node:internal/test_runner/test:964:19)
      at Test.run (node:internal/test_runner/test:907:12)
      at async Promise.all (index 0)
      at async Suite.run (node:internal/test_runner/test:1226:7)
      at async Test.processPendingSubtests (node:internal/test_runner/test:574:7)

Compared to mocha:

     AssertionError: should be a number: expected 'hello' to be a number
      at Context.<anonymous>
      at process.processImmediate (node:internal/timers:483:21)

I guess the ERR_TEST_FAILURE should be unwrapped. There are a number of extra stack frames too, but I'm not sure if that's important.

cjihrig commented 1 month ago

By the way, nice work on this reporter: https://github.com/cjihrig/test-runner-ecosystem/actions/runs/10443936521/job/28917907794

MoLow commented 4 weeks ago

Will take a look once I am back from vacation