Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

The Runner.checkGlobals new Error doesn't provide err.stack.

Standa Opichal0c397fec8c10
diff --git a/lib/reporters/tap.js b/lib/reporters/tap.js
index f48776b9..ae3e062a 100644
--- a/lib/reporters/tap.js
+++ b/lib/reporters/tap.js
@@ -50,7 +50,7 @@ function TAP(runner) {
runner.on('fail', function(test, err){
failures++;
console.log('not ok %d %s', n, title(test));
- console.log(err.stack.replace(/^/gm, ' '));
+ if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
});
runner.on('end', function(){
diff --git a/mocha.js b/mocha.js
index 917faa27..a2099df5 100644
--- a/mocha.js
+++ b/mocha.js
@@ -3294,7 +3294,7 @@ function TAP(runner) {
runner.on('fail', function(test, err){
failures++;
console.log('not ok %d %s', n, title(test));
- console.log(err.stack.replace(/^/gm, ' '));
+ if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
});
runner.on('end', function(){