I am setting up tests for my app using mocha and wanted to use multiple modules but it seems the -r (--require) argument only allows to use one module(?).
--require module --require some_other_module --require yet_another_module
@boneskull does it work on your system? Because when I try it, it doesn't give an error, but only loads the first package mentioned. Ditto when done using mocha.opts.
yes.
// a.js
console.log('a');
// b.js
console.log('b');
// test.js
const assert = require('assert');
describe('test', function () {
it('should pass', function () {
assert(true);
});
});
$ mocha --require a --require b test.js
a
b
test
✓ should pass
1 passing (6ms)
@boneskull Any particular reason a list isn't supported? -r foo bar or -r foo, bar
--require x --require y
@boneskull My apologies if I wasn't clear; why not support something like --globals where values are separated by commas (or spaces)?
Most helpful comment
--require module --require some_other_module --require yet_another_module