auto globals
Add browser globals on every test, and remove when it is done.
Install
npm i auto-globals
Example
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();
});
Related
- 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.
License
MIT