0.0.2 • Published 5 years ago

mocha-setup v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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