sábado, 7 de noviembre de 2015

jasmine for node: execute test files and set jasmine timeout globally

When developing jasmine tests in node, I want to declare which files to run. I don't want / like the way of indicating this in a jasmine.json file and it wasn't working as expected.
Also I had some difficulties guesssing how to set the timeout interval globally. Mainly my difficuly was not to now that jasmine was creating a global 'jasmine' object when requiring it.
The following code shows both things:
var
 path = require('path')
, glob = require('glob').sync
, Jasmine = require('jasmine')

var jasmineRunner = new Jasmine();
jasmine.DEFAULT_TIMEOUT_INTERVAL = 99999999;

jasmineRunner.specFiles = glob(path.join(__dirname, '*Spec.js'));
jasmineRunner.execute();

No hay comentarios: