Permalink
Browse files

Don’t affect line numbers with --requireJsSetup

Run the requireJS setup file so that it does not influence line numbers of spec files.
  • Loading branch information...
1 parent d82be42 commit fbdbb60a710a19016a22b0b69bc6e1d780db9c92 @davidaurelio davidaurelio committed Oct 8, 2013
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/jasmine-node/requirejs-runner.js
View
9 lib/jasmine-node/requirejs-runner.js
@@ -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);

0 comments on commit fbdbb60

Please sign in to comment.