Use node's vm module instead of deprecated process.compile

So that I don't have to watch the warning all the time :-D
This commit is contained in:
Vojta Jina 2011-05-24 13:57:52 +02:00 committed by Igor Minar
parent 22dee3e278
commit d05e839920
2 changed files with 7 additions and 5 deletions

View file

@ -1,6 +1,7 @@
var fs = require('fs');
var sys = require('sys');
var path = require('path');
var vm = require('vm');
var filename = __dirname + '/jasmine.js';
global.window = {
@ -10,7 +11,7 @@ global.window = {
clearInterval: clearInterval
};
var src = fs.readFileSync(filename);
var jasmine = process.compile(src + '\njasmine;', filename);
var jasmine = vm.runInThisContext(src + '\njasmine;', filename);
delete global.window;
function noop(){}
@ -41,10 +42,10 @@ jasmine.executeSpecsInFolder = function(folder, done, isVerbose, showColors, mat
jasmineEnv.reporter = {
log: function(str){
},
reportSpecStarting: function(runner) {
},
reportRunnerStarting: function(runner) {
sys.puts('Started');
start = Number(new Date);
@ -135,7 +136,7 @@ jasmine.getAllSpecFiles = function(dir, matcher){
}
}
}
return specs;
};

View file

@ -1,6 +1,7 @@
var fs = require('fs');
var vm = require('vm');
var filename = __dirname + '/showdown-0.9.js';
var src = fs.readFileSync(filename);
var Showdown = process.compile(src + '\nShowdown;', filename);
var Showdown = vm.runInThisContext(src + '\nShowdown;', filename);
exports.Showdown = Showdown;