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