Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fix hook error in browser reporter by moving body prop from test to runnable

Daniel St. Julesf7a42fc77647
diff --git a/lib/runnable.js b/lib/runnable.js
index 9ac45de3..f8a2af72 100644
--- a/lib/runnable.js
+++ b/lib/runnable.js
@@ -45,6 +45,7 @@ module.exports = Runnable;
function Runnable(title, fn) {
this.title = title;
this.fn = fn;
+ this.body = (fn || '').toString();
this.async = fn && fn.length;
this.sync = !this.async;
this._timeout = 2000;
diff --git a/lib/test.js b/lib/test.js
index b39ce42c..a95cd31a 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -22,7 +22,6 @@ function Test(title, fn) {
Runnable.call(this, title, fn);
this.pending = !fn;
this.type = 'test';
- this.body = (fn || '').toString();
}
/**