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, {...})
        }

/mocha-setup/

    Package Sidebar

    Install

    npm i mocha-setup

    Weekly Downloads

    1

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    3.26 kB

    Total Files

    5

    Last publish

    Collaborators

    • omrilotan