lundi 12 janvier 2015

mocha --require programmatically


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.





1 commentaire:

  1. Require it in the same file as Mocha. This worked for me.

    var Mocha = require('mocha'),
    fs = require('fs'),
    path = require('path'),
    global = require('pathtofile'); <<--- add it here

    RépondreSupprimer