This is a simple one-liner, excepting the associated test. Previously, the Promise that Pool.clear() returned would resolve with an array of undefined values because that Promise was created using Promise.all(), which resolves with an array of all the component Promises' resolved values. This was a minor annoyance in some tape unit tests because I would do something like
test('something with a pool', function(t) {
// ...
const pool = genericPool.createPool(/* ... */);
// ...
pool.drain().then(() => {
return pool.clear()
})
.then(t.end, t.fail);
});
The above test would fail because that array of undefined values would be passed to t.end, which fails the test if invoked with a truthy argument. Of course this was easy to work around once I figured out what was actually happening, but in any event, resolving the clear()Promise with an array of undefined just seems undesirable.
This is a simple one-liner, excepting the associated test. Previously, the
Promise
thatPool.clear()
returned would resolve with an array ofundefined
values because thatPromise
was created usingPromise.all()
, which resolves with an array of all the componentPromise
s' resolved values. This was a minor annoyance in some tape unit tests because I would do something likeThe above test would fail because that array of
undefined
values would be passed tot.end
, which fails the test if invoked with a truthy argument. Of course this was easy to work around once I figured out what was actually happening, but in any event, resolving theclear()
Promise
with an array ofundefined
just seems undesirable.