Execute mocha test from npm test

This commit is contained in:
kpdecker
2012-07-23 13:47:52 -05:00
parent 09ac8ac24b
commit eb509a4b8b
2 changed files with 30 additions and 1 deletions
+6 -1
View File
@@ -17,10 +17,15 @@
"optimist": "~0.3",
"uglify-js": "~1.2"
},
"devDependencies": {},
"devDependencies": {
"mocha": "*"
},
"main": "lib/handlebars.js",
"bin": {
"handlebars": "bin/handlebars"
},
"scripts": {
"test": "node_modules/.bin/mocha -u qunit spec/qunit_spec.js"
},
"optionalDependencies": {}
}
+24
View File
@@ -1,3 +1,27 @@
var Handlebars;
if (!Handlebars) {
// Setup for Node package testing
Handlebars = require('../lib/handlebars');
var assert = require("assert"),
equal = assert.equal,
equals = assert.equal,
ok = assert.ok;
// Note that this doesn't have the same context separation as the rspec test.
// Both should be run for full acceptance of the two libary modes.
var CompilerContext = {
compile: function(template, options) {
var templateSpec = Handlebars.precompile(template, options);
return Handlebars.template(eval('(' + templateSpec + ')'));
},
compileWithPartial: function(template, options) {
return Handlebars.compile(template, options);
}
};
}
suite("basic context");
Handlebars.registerHelper('helperMissing', function(helper, context) {