Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

mocha-setup

0.0.2 • Public • Published

mocha-setup CircleCI

🚨 A mocha require file including some basic things I usually use

This setup includes the globals:

  • chai functions: assert, expect
  • sinon
  • sinon function: spy, fake, stub
  • abuser

It also extends chai with:

  • chai-as-promised
  • chai-string
  • deep-equal-in-any-order
  • sinon-chai

package.json

  ...
  "test""mocha '**/spec.js' --require .mocha.js --recursive --exclude 'node_modules'",
  ...

.mocha.js

require('mocha-setup');
 
// Your other things
process.on('unhandledRejection', error => { throw error; });

.eslintrc.js

const globals = require('mocha-setup/globals');
 
module.exports = {
    ...
    overrides: [
        {
            files: [ "**/spec.js" ],
            globals
        }
    ]
};

Or add to your own globals

            ...
            globals: Object.assign(globals, {...})
        }

Install

npm i mocha-setup

DownloadsWeekly Downloads

6

Version

0.0.2

License

MIT

Unpacked Size

3.26 kB

Total Files

5

Last publish

Collaborators

  • avatar