Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emphasize user code in stack traces #27553

Open
dandv opened this issue Jan 4, 2025 · 0 comments
Open

Emphasize user code in stack traces #27553

dandv opened this issue Jan 4, 2025 · 0 comments

Comments

@dandv
Copy link

dandv commented Jan 4, 2025

Creating a new issue after discussion in #24002.

I’d like to propose a feature to improve readability when working with stack traces. Currently, assertion errors generate a verbose stack trace that includes both user code and internal library or runtime code. It can be challenging to quickly locate the lines relevant to my own logic amidst calls from the Deno standard library or third-party modules.

Failed assertions would be a good start for this feature, given stack traces are gnarly enough that a flag was created to hide them.

error: AssertionError: Values are not strictly equal.


    [Diff] Actual / Expected


-   5
+   3

  throw new AssertionError(message);
        ^
    at assertStrictEquals (https://jsr.io/@std/assert/1.0.10/strict_equals.ts:66:9)
    at toBe (https://jsr.io/@std/expect/1.0.10/_matchers.ts:29:5)
    at applyMatcher (https://jsr.io/@std/expect/1.0.10/expect.ts:223:13)
    at Proxy.<anonymous> (https://jsr.io/@std/expect/1.0.10/expect.ts:233:13)
    at checkQueueAndResults (file:///home/dandv/project/tests/common.ts:187:39) ⬅️
    at Object.runMicrotasks (ext:core/01_core.js:683:26)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:59:10)
    at runNextTicks (ext:deno_node/_next_tick.ts:76:3)
    at eventLoopTick (ext:core/01_core.js:182:21)
    at async Object.<anonymous> (file:///home/dandv/project/tests/unit.test.ts:349:7) ⬅️

Proposal

– Highlight or visually distinguish user code in the stack trace, for example with a marker like ⬅️ (since bold and colors are already used)

– Either hide references to the Deno and library calls, or de-emphasize them (greyed out?) so they don’t obscure the code paths I’m actively debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant