8000 🐛 Bug: Browser doesn't include call stack for global uncaught errors · Issue #5106 · mochajs/mocha · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
🐛 Bug: Browser doesn't include call stack for global uncaught errors #5106
Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Bug Report Checklist

  • I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
  • I have searched for related issues and issues with the faq label, but none matched my issue.
  • I have 'smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, my usage of Mocha, or Mocha itself.
  • I want to provide a PR to resolve this

Expected

When an uncaught error occurs during a test in browsers, you'd expect to see the call stack. That's useful.

Error: Oh no!
    at inner (test.example.js:8:15)

Actual

Mocha's browser error handling code was written before browsers gave nice stacks (eb58761).

Error: Error: Oh no! (http://127.0.0.1:8081/test.example.js:8)

Minimal, Reproducible Example

Using a minimal browser setup such as in mochajs/mocha-examples#72:

it("example", (done) => {
    function inner() {
        throw new Error("Oh no!");
    }

    setTimeout(inner);
});

Versions

Mocha: 10.3.0

Additional Info

This was filed long ago in #2167, then a fix proposed in #3952. Since #2167 is quite old, re-filing to be more current.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: browserbrowser-specificstatus: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0