push
travis-ci
1808 of 1898 branches covered (95.26%)
35 of 35 new or added lines in 2 files covered. (100.0%)
3262 of 3322 relevant lines covered (98.19%)
5055.74 hits per line
1 |
const Promise = require('unexpected-bluebird');
|
30✔ |
2 |
|
|
3 |
const workQueue = { |
30✔ |
4 |
queue: [],
|
|
5 |
drain() { |
|
6 |
this.queue.forEach(fn => {
|
26,532✔ |
7 |
fn(); |
12,278✔ |
8 |
}); |
|
9 |
this.queue = [];
|
26,532✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
13 |
const scheduler = Promise.setScheduler(fn => { |
30✔ |
14 |
workQueue.queue.push(fn); |
12,060✔ |
15 |
scheduler(() => { |
12,060✔ |
16 |
workQueue.drain(); |
12,060✔ |
17 |
}); |
|
18 |
}); |
|
19 |
|
|
20 |
Promise.prototype._notifyUnhandledRejection = function() { |
30✔ |
21 |
const that = this;
|
3,748✔ |
22 |
scheduler(() => { |
3,748✔ |
23 |
if (that._isRejectionUnhandled()) {
|
|
24 |
if (workQueue.onUnhandledRejection) {
|
|
25 |
// for testing
|
|
26 |
workQueue.onUnhandledRejection(that.reason()); |
2✔ |
27 |
} else {
|
|
28 |
throw that.reason();
|
× |
29 |
} |
|
30 |
} |
|
31 |
}); |
|
32 |
}; |
|
33 |
|
|
34 |
module.exports = workQueue; |
30✔ |