-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proper support for after with a passed async function in wrapped mode (
#75) * Avoid swallowing errors in .after() without argument * Proper support for after with a passed async function in wrapped mode
- Loading branch information
Showing
3 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict' | ||
|
||
const t = require('tap') | ||
const boot = require('..') | ||
const app = {} | ||
|
||
boot(app) | ||
|
||
t.plan(5) | ||
|
||
app.use(function (f, opts) { | ||
return Promise.reject(new Error('kaboom')) | ||
}).after(function (err, cb) { | ||
t.pass('this is just called') | ||
cb(err) | ||
}).after(function () { | ||
t.pass('this is just called') | ||
}).after(function (err, cb) { | ||
t.pass('this is just called') | ||
cb(err) | ||
}) | ||
|
||
app.ready().then(() => { | ||
t.fail('this should not be called') | ||
}).catch(err => { | ||
t.ok(err) | ||
t.strictEqual(err.message, 'kaboom') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters