↩ī¸Ž

mocha-setup CircleCI

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

This setup includes the globals:

It also extends chai with:

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