v1.0.0
poll
I’ve ported the poll
function to TypeScript to give me a comfortable way of creating both a CommonJS and an ES module out of a single source. This comes with the downside of not being able to produce a CommonJS module which uses module.exports = poll
. I can only get the TypeScript compiler to produce exports.default = poll
or exports.poll = poll
. What this means is that you can’t have a CommonJS module compiled from a TypeScript source which you can import with require('poll')
.
Breaking changes:
-
Importing the CommonJS module with
require('poll')
no longer resolves to thepoll
function. Userequire('poll').default
instead.const poll = require('poll').default;
Non-breaking changes:
-
The package is now available as an ES module. If you use
poll
as animport poll from 'poll/dist/esm/poll.mjs'; dependency, import it like this:import poll from 'poll/dist/esm/poll.mjs';
-
Tests now use Jest instead of Ava.
-
Tests are now based on fake timers instead of calling
setTimeout
in the tests directly. Unfortunately, tests still require a lot of trickery to manually clear out the promise queue. If you know how to test this without sprinklingawait Promise.resolve()
all over my tests, I’m all ears!