I am able to get stacktrace with
var stackTrace = test.err.stack;
質問
I am running tests using mocha programmatically and able to run the tests, get full title using following code but I couldn't find any way to get complete stack trace that is being printed on the commandline. How do I get the complete stack trace using mocha as library.
mocha.run(function(failures){
if (failures) {
console.log('it failed');
} else {
console.log('it passed');
}
process.on('exit', function () {
process.exit(failures);
});
}).on('fail', function(test){
title = test.fullTitle();
}).on('pass', function(test){
title = test.fullTitle();
});
解決
I am able to get stacktrace with
var stackTrace = test.err.stack;