mochaRequire

  • page
steal-mocha.config.mochaRequire  

Mocha's runner allows for a mocha.opts file, specifying addition options such as checkLeaks(). steal-mocha does not parsed a mocha.opts file, however allows the specification of a startup script through mochaRequire.

This is similar to the --require option in mocha.opts.

<script src="node_modules/steal/steal.js"
  mocha-require="test/setup"
  main="test/test"></script>

The path in mocha-require is a module name.

test/setup.js

const chai = require('chai');
const sinon = require('sinon');

module.exports = function(mocha) {
  sinon.assert.expose(chai.assert, { prefix: '' });
};

The above example extends Chai's assertion library with SinonJS assertions.

Help us improve StealJS by taking our community survey