Skip to content

Commit

Permalink
reject falsy will not emit an error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim de Beer committed Dec 12, 2016
1 parent e3587f1 commit e39d7d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const extendSet = (t, val, stamp) => {
}
}

const error = (t, err, stamp) => generic(root(t), 'error', err, stamp)
const error = (t, err, stamp) => err && generic(root(t), 'error', err, stamp)

const isGeneratorFunction = obj => {
const constructor = obj.constructor
Expand Down
14 changes: 13 additions & 1 deletion test/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,19 @@ test('async - promise all', t => {
return 'lulllz'
}))

a.once('lulllz', () => { t.end() })
a.once('lulllz', () => {
var cnt = 0
a.on('error', () => ++cnt)

a.set(new Promise((resolve, reject) => {
reject()
}))

process.nextTick(() => {
t.equal(cnt, 0, 'does not fire error event')
t.end()
})
})
})

test('async - advanced', t => {
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require('./on')
require('./remove')
require('./compute')
require('./props')
require('./async')
require('./references')
require('./subscribe')
require('./context')
require('./async')

0 comments on commit e39d7d1

Please sign in to comment.