push
travis-ci
1851 of 1948 branches covered (95.02%)
2 of 2 new or added lines in 1 file covered. (100.0%)
3276 of 3342 relevant lines covered (98.03%)
3209.0 hits per line
1 |
const Promise = require('unexpected-bluebird');
|
17✔ |
2 |
|
|
3 |
const workQueue = { |
17✔ |
4 |
queue: [],
|
|
5 |
drain() { |
|
6 |
this.queue.forEach(fn => {
|
14,540✔ |
7 |
fn(); |
6,734✔ |
8 |
}); |
|
9 |
this.queue = [];
|
14,540✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
13 |
const scheduler = Promise.setScheduler(fn => { |
17✔ |
14 |
workQueue.queue.push(fn); |
6,625✔ |
15 |
scheduler(() => { |
6,625✔ |
16 |
workQueue.drain(); |
6,625✔ |
17 |
}); |
|
18 |
}); |
|
19 |
|
|
20 |
Promise.prototype._notifyUnhandledRejection = function() { |
17✔ |
21 |
const that = this;
|
2,205✔ |
22 |
scheduler(() => { |
2,205✔ |
23 |
if (that._isRejectionUnhandled()) {
|
|
24 |
if (workQueue.onUnhandledRejection) {
|
|
25 |
// for testing
|
|
26 |
workQueue.onUnhandledRejection(that.reason()); |
× |
27 |
} else {
|
|
28 |
throw that.reason();
|
1✔ |
29 |
} |
|
30 |
} |
|
31 |
}); |
|
32 |
}; |
|
33 |
|
|
34 |
module.exports = workQueue; |
17✔ |