I am using Chai.js on Node.
The line console.log(e)
where e is an exception thrown by Chai.js print something like expected a to be within 0..3
.
How can I make the exception of Chai.js include stack trace info?
I found the answer. I can config chai to enable stack trace. Here's the code on assertion styles page of chai.
var chai = require('chai');
chai.Assertion.includeStack = true; // defaults to false
I don't use Chai.JS. But if e is an Error object, you can use the property stack of the object to get the stack trace.
The core module "util" may also help you : http://nodejs.org/api/util.html