auto-globals

4.0.1 • Public • Published

auto globals NPM version Build Status Coverage Status

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

Readme

Keywords

Package Sidebar

Install

npm i auto-globals

Weekly Downloads

47

Version

4.0.1

License

MIT

Unpacked Size

9.18 kB

Total Files

6

Last publish

Collaborators

  • coderaiser