Search code examples
javascriptunit-testingqunit

How to get QUnit to print backtrace on exception?


When an exception occurs in my QUnit tests, all it will say is

Died on test #n: message

How do I get it to print a backtrace or some other location information so that I can see where the exception occurred?


Solution

  • I don't think it is possible to make QUnit give you a trace of where the error happened. Your code has generated an exception, which QUnit has caught and reported. If you tick the 'notrycatch' checkbox at the top of the QUnit results, your tests will run again, but this time QUnit won't catch the exception. Your browser may then give you more information on what actually happened, but it will depend on what the error was.