我正在使用mocha以编程方式运行测试,并能够运行测试,使用以下代码获得完整的标题,但我找不到任何方法来获得在命令行上打印的完整堆栈跟踪。如何使用mocha作为库获得完整的堆栈跟踪。
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();
});
我可以使用
获得stacktracevar stackTrace = test.err.stack;