Closed mjhm closed 10 months ago
Seems related to https://github.com/mochajs/mocha/issues/1766 Can you checkout https://github.com/mochajs/mocha/pull/1767 and confirm whether or not it helps?
@danielstjules In my test case it looks like https://github.com/mochajs/mocha/pull/1767 prints out pretty much the same as the --full-trace
option with mocha@2.2.5
. Unfortunately this still misses the stack trace lines for the JSDOM loaded files.
1) Basic Test throws an error in the actual test:
Error: throws something
at Context.<anonymous> (/Users/johnmclaughlin/git/mocha_jsdom_test/all_tests.js:27:11)
at callFn (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:266:21)
at Test.Runnable.run (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:259:7)
at Runner.runTest (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:390:10)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:473:12
at next (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:315:14)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:325:7
at next (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:260:23)
at Immediate._onImmediate (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:292:5)
at processImmediate [as _immediateCallback] (timers.js:358:17)
2) Basic Test throws an error from a node require:
Error: thrower
at module.exports (/Users/johnmclaughlin/git/mocha_jsdom_test/thrower.js:3:9)
at Context.<anonymous> (/Users/johnmclaughlin/git/mocha_jsdom_test/all_tests.js:31:5)
at callFn (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:266:21)
at Test.Runnable.run (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:259:7)
at Runner.runTest (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:390:10)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:473:12
at next (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:315:14)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:325:7
at next (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:260:23)
at Immediate._onImmediate (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:292:5)
at processImmediate [as _immediateCallback] (timers.js:358:17)
3) Basic Test throws an async error from a node require:
Uncaught Error: thrower
at module.exports (/Users/johnmclaughlin/git/mocha_jsdom_test/thrower.js:3:9)
at null._onTimeout (/Users/johnmclaughlin/git/mocha_jsdom_test/all_tests.js:36:7)
at Timer.listOnTimeout (timers.js:110:15)
4) Basic Test throws an error in a jsdom script:
Error: the object {
"data": {
"error": "Error: direct throw from file"
"filename": "file:///Users/johnmclaughlin/git/mocha_jsdom_test/directThrow.js"
}
"message": "Running file:///Users/johnmclaughlin/git/mocha_jsdom_test/directThrow.js failed."
"type": "error"
"uncaught": true
} was thrown, throw an Error :)
at Runner.fail (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:206:11)
at Runner.uncaught (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:583:8)
at process.uncaught (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:612:10)
at process.emit (events.js:107:17)
at process._fatalException (node.js:236:26)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/jsdom/lib/jsdom.js:249:18
at process._tickCallback (node.js:355:11)
5) Basic Test throws an error in a jsdom done callback:
Uncaught Error: thrower
at Object.module.exports [as done] (/Users/johnmclaughlin/git/mocha_jsdom_test/thrower.js:3:9)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/jsdom/lib/jsdom.js:249:18
at process._tickCallback (node.js:355:11)
6) Basic Test with beforeEach jsdom setup throws a jsdom browser error from preloaded file.:
Error: the error {} was thrown, throw an Error :)
at Runner.fail (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:206:11)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:480:18
at done (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:222:5)
at Test.Runnable.run (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:245:7)
at Runner.runTest (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:390:10)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:473:12
at next (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:315:14)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:325:7
at next (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:260:23)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runner.js:287:7
at done (/Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:222:5)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/mocha/lib/runnable.js:242:9
at Context.jsdomDoneCallback (/Users/johnmclaughlin/git/mocha_jsdom_test/all_tests.js:12:3)
at /Users/johnmclaughlin/git/mocha_jsdom_test/node_modules/jsdom/lib/jsdom.js:249:18
at process._tickCallback (node.js:355:11)
@danielstjules I'm gonna put this on your plate :smile:
@boneskull haha cool, will take a look this weekend
Any updates on this? :smile:
I am a bot that watches issues for inactivity.
This issue hasn't had any recent activity, and I'm labeling it stale
. In 14 days, if there are no further comments or activity, I will close this issue.
Thanks for contributing to Mocha!
This should have been fixed in #1767. Also the issue is very old and hasn't been interacted with since 2017. Marking as closed. ✔️
But if I'm wrong and it's still an active issue, please do file a new issue using one of our new issue templates. They'll ask for the info we'd need to re-triage this. Cheers all!
I put up a test case repo at https://github.com/mjhm/mocha_jsdom_test
As mentioned in the README the repo shows a change in handling jsdom stack traces.
The problem is that for mocha@2.2.X the handling of stack traces has changed so that stack traces of JSDOM loaded scripts are no longer useful.
In particular the report of last test using mocha@2.1.0 is
But the result for mocha@2.2.5 is not useful for tracking down the source of the error:
There are differences in the other tests as well.
jsdom
.Complete test report for mocha@2.2.5:
Complete test report for mocha@2.1.0