Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Jul 27, 2020
1 parent c149bdb commit 46cf90a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ function createMultipleDoneError(runnable, originalErr) {
if (runnable.file) {
message += format(' of file %s', runnable.file);
}

if (originalErr) {
message += format('; in addition, done() received error: %s', originalErr);
}
Expand Down
10 changes: 8 additions & 2 deletions test/unit/runner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ describe('Runner', function() {
function assertHookTitle() {
expect(hook.title, 'to be', expectedHookTitle);
}
var failHook = false;
var hookError = new Error('failed hook');
suite.beforeEach(function() {
assertHookTitle();
if (failHook) {
throw hookError;
}
});
runner.on(EVENT_HOOK_BEGIN, assertHookTitle);
runner.on(EVENT_HOOK_END, assertHookTitle);
Expand All @@ -276,12 +281,13 @@ describe('Runner', function() {
runner.test = suite.tests[0];
expectedHookTitle = '"before each" hook for "should behave"';
runner.hook('beforeEach', function(err) {
if (err) return done(err);
if (err && err !== hookError) return done(err);

runner.test = suite.tests[1];
failHook = true;
expectedHookTitle = '"before each" hook for "should obey"';
runner.hook('beforeEach', function(err) {
if (err) return done(err);
if (err && err !== hookError) return done(err);
return done();
});
});
Expand Down

0 comments on commit 46cf90a

Please sign in to comment.