Add browser globals on every test, and remove when it is done.
npm i auto-globals
const autoGlobals = require('auto-globals');
const tape = autoGlobals(require('supertape'));
const fn = () => {
document.body.addEventListener('click', console.log);
};
test('lib: arguments', (t, {document}) => {
fn();
t.ok(document.body.calledWith('click', console.log), 'should call addEventListener');
t.end();
});
- try-catch - functional try-catch wrapper.
- try-to-catch - functional try-catch wrapper for promises.
- try-to-tape - wrap
tape
async
functions and show error on reject.
MIT