avajs / ava

Node.js test runner that lets you develop with confidence 🚀
MIT License
20.74k stars 1.41k forks source link

Retain internal stack lines for errors, but color differently #2412

Closed szmarczak closed 4 years ago

szmarczak commented 4 years ago

It would be quite useful because there's sometimes missing context.

novemberborn commented 4 years ago

Could you provide more, uhm, context?

szmarczak commented 4 years ago

I see what you did here :P

Example:

  PromisableRequest._destroy (dist/source/core/index.js:935:21)
  PromisableRequest._beforeError (dist/source/core/index.js:855:14)
  dist/source/core/index.js:262:22

Full stack trace:

    at PromisableRequest._destroy (/home/szm/Desktop/got/dist/source/core/index.js:935:21)
    at PromisableRequest.destroy (internal/streams/destroy.js:55:8)
    at PromisableRequest._beforeError (/home/szm/Desktop/got/dist/source/core/index.js:855:14)
    at /home/szm/Desktop/got/dist/source/core/index.js:262:22
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

I think that at PromisableRequest.destroy (internal/streams/destroy.js:55:8) is quite important. Without this AVA implies that _beforeError called _destroy directly.

novemberborn commented 4 years ago

Yea I don't really know why we even do this. If anything, we should use colors and separators to highlight the most useful lines, but not remove anything. Other than AVA-introduced lines.

IIRC this happens in https://github.com/avajs/ava/blob/master/lib/beautify-stack.js.

novemberborn commented 4 years ago

@szmarczak so you filed https://github.com/avajs/ava/issues/2110 last year, which is pretty similar 😉

There's a PR to fix that one (https://github.com/avajs/ava/pull/2420) which is great. However I think we should still consider retaining the internal stack lines for all errors, whether or not they originated outside of user code, and use color to indicate their relevance.

So we'll keep this issue open.

novemberborn commented 4 years ago

However I think we should still consider retaining the internal stack lines for all errors, whether or not they originated outside of user code, and use color to indicate their relevance.

I think this was addressed in #2420 as well.