Fix test runners under node
This commit is contained in:
Vendored
+15
-6
@@ -1,15 +1,24 @@
|
||||
require('./common');
|
||||
|
||||
global.Handlebars = require('../../dist/handlebars.runtime');
|
||||
var _ = require('underscore'),
|
||||
fs = require('fs'),
|
||||
vm = require('vm');
|
||||
|
||||
var compiler = require('../../lib/handlebars');
|
||||
global.Handlebars = undefined;
|
||||
vm.runInThisContext(fs.readFileSync(__dirname + '/../../dist/handlebars.runtime.js'), 'dist/handlebars.runtime.js');
|
||||
|
||||
var compiler = require('../../dist/cjs/handlebars/compiler/compiler');
|
||||
|
||||
global.CompilerContext = {
|
||||
compile: function(template, options, env) {
|
||||
compile: function(template, options) {
|
||||
var templateSpec = compiler.precompile(template, options);
|
||||
return Handlebars.template(eval('(' + templateSpec + ')'), env);
|
||||
return handlebarsEnv.template(eval('(' + templateSpec + ')'));
|
||||
},
|
||||
compileWithPartial: function(template, options, env) {
|
||||
return compiler.compile(template, options);
|
||||
compileWithPartial: function(template, options) {
|
||||
// Hack the compiler on to the environment for these specific tests
|
||||
handlebarsEnv.compile = function(template, options) {
|
||||
return compiler.compile(template, options, handlebarsEnv);
|
||||
};
|
||||
return handlebarsEnv.compile(template, options);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user