Skip to content

Commit

Permalink
Don’t affect line numbers with --requireJsSetup
Browse files Browse the repository at this point in the history
Run the requireJS setup file so that it does not influence line numbers of spec files.
  • Loading branch information
David Aurelio committed Oct 8, 2013
1 parent d82be42 commit fbdbb60
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/jasmine-node/requirejs-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,19 @@ exports.executeJsRunner = function(specCollection, done, jasmineEnv, setupFile)
};

specCollection.getSpecs().forEach(function(s){
var script = fs.readFileSync(s.path(), 'utf8'),
wrappedScript;
var script = fs.readFileSync(s.path(), 'utf8');

if (s.filename().substr(-6).toLowerCase() == 'coffee') {
script = coffeescript.compile(script);
}

wrappedScript = template + script;

var newContext = buildNewContext(s);
newContext.setTimeout = jasmine.getGlobal().setTimeout;
newContext.setInterval = jasmine.getGlobal().setInterval;

vm.runInNewContext(wrappedScript, newContext, s.path());
var vmContext = vm.createContext(newContext);
vm.runInContext(template, vmContext);
vm.runInContext(script, vmContext, s.path());
});

specLoader.executeWhenAllSpecsAreComplete(jasmineEnv);
Expand Down

0 comments on commit fbdbb60

Please sign in to comment.