How can I exclude Chai.js, including stack trace information?

I use Chai.js on Node. The console.log(e) , where e is the exception that Chai.js prints something like expected a to be within 0..3 . How can I exclude Chai.js from including stack trace information?

+4
source share
2 answers

I have found the answer. I can configure chai to enable stack tracing. Here's the code on the chai approval styles page .

 var chai = require('chai'); chai.Assertion.includeStack = true; // defaults to false 
+6
source

I do not use Chai.JS. But if e is an Error object, you can use the object's property stack to get the stack trace.

The core util module can also help you: http://nodejs.org/api/util.html

0
source

Source: https://habr.com/ru/post/1445946/


All Articles