summaryrefslogtreecommitdiffstats
path: root/spec/env
diff options
context:
space:
mode:
Diffstat (limited to 'spec/env')
-rw-r--r--spec/env/browser.js7
-rw-r--r--spec/env/runner.js24
-rw-r--r--spec/env/runtime.js7
3 files changed, 32 insertions, 6 deletions
diff --git a/spec/env/browser.js b/spec/env/browser.js
index 8049dda..60a5d35 100644
--- a/spec/env/browser.js
+++ b/spec/env/browser.js
@@ -4,7 +4,12 @@ var fs = require('fs'),
vm = require('vm');
global.Handlebars = 'no-conflict';
-vm.runInThisContext(fs.readFileSync(__dirname + '/../../dist/handlebars.js'), 'dist/handlebars.js');
+
+var filename = 'dist/handlebars.js';
+if (global.minimizedTest) {
+ filename = 'dist/handlebars.min.js';
+}
+vm.runInThisContext(fs.readFileSync(__dirname + '/../../' + filename), filename);
global.CompilerContext = {
browser: true,
diff --git a/spec/env/runner.js b/spec/env/runner.js
index 4ff1e7e..f4b23d8 100644
--- a/spec/env/runner.js
+++ b/spec/env/runner.js
@@ -7,19 +7,35 @@ var errors = 0,
testDir = path.dirname(__dirname),
grep = process.argv[2];
+// Lazy hack, but whatever
+if (grep === '--min') {
+ global.minimizedTest = true;
+ grep = undefined;
+}
+
var files = fs.readdirSync(testDir)
.filter(function(name) { return (/.*\.js$/).test(name); })
.map(function(name) { return testDir + '/' + name; });
-run('./runtime', function() {
- run('./browser', function() {
- run('./node', function() {
+if (global.minimizedTest) {
+ run('./runtime', function() {
+ run('./browser', function() {
/* eslint-disable no-process-exit */
process.exit(errors);
/* eslint-enable no-process-exit */
});
});
-});
+} else {
+ run('./runtime', function() {
+ run('./browser', function() {
+ run('./node', function() {
+ /* eslint-disable no-process-exit */
+ process.exit(errors);
+ /* eslint-enable no-process-exit */
+ });
+ });
+ });
+}
function run(env, callback) {
diff --git a/spec/env/runtime.js b/spec/env/runtime.js
index 9d1c049..642acd3 100644
--- a/spec/env/runtime.js
+++ b/spec/env/runtime.js
@@ -4,7 +4,12 @@ var fs = require('fs'),
vm = require('vm');
global.Handlebars = 'no-conflict';
-vm.runInThisContext(fs.readFileSync(__dirname + '/../../dist/handlebars.runtime.js'), 'dist/handlebars.runtime.js');
+
+var filename = 'dist/handlebars.runtime.js';
+if (global.minimizedTest) {
+ filename = 'dist/handlebars.runtime.min.js';
+}
+vm.runInThisContext(fs.readFileSync(__dirname + '/../../' + filename), filename);
var parse = require('../../dist/cjs/handlebars/compiler/base').parse;
var compiler = require('../../dist/cjs/handlebars/compiler/compiler');