Skip to content
This repository was archived by the owner on Dec 27, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ function setupGlobals(mocha) {
//forking mocha itself.

const wrappedFunction = function (done) {
var self = this._runnable;
var self = this;
var runnable = this._runnable;
var run = function() {
try {
// Sync call
if (fn.length == 0) {
var result = fn.call(self);
if (result && typeof result.then === 'function') {
self.resetTimeout();
runnable.resetTimeout();
result
.then(function() {
done();
Expand All @@ -45,7 +46,7 @@ function setupGlobals(mocha) {
done(reason || new Error('Promise rejected with no or falsy reason'));
});
} else {
if (self.asyncOnly) {
if (runnable.asyncOnly) {
return done(new Error('--async-only option in use without declaring `done()` or returning a promise'));
}

Expand Down