I use the --require flag to pass Mocha a file with globals set. I am trying to now use Mocha programmatically following this example. I still want the functionality of the globals so I don't have to require everything in each and every test. Is there a way to do so? I can't seem to figure out a reasonable way to do so.
Require it in the same file as Mocha. This worked for me.
RépondreSupprimervar Mocha = require('mocha'),
fs = require('fs'),
path = require('path'),
global = require('pathtofile'); <<--- add it here