Files
handlebars.js/spec/env/runner.js
T
Nils Knappmeier 47adcda485 Fix build on Windows
- Handle path-separators properly. Use "path.sep" instead of "/".
  Or use "require.resolve()" if possible
- Use "execFile" instead of "exec" to run the Handlebars executable.
  This prevents problems due to (missing) shell escaping.
- Use explicit call to "node" in order to run the executable on Windows.
- Add "appveyor"-CI in order to run regular tests on Windows.
2019-06-28 23:44:43 -07:00

47 lines
1014 B
JavaScript

/*eslint-disable no-console */
var fs = require('fs'),
Mocha = require('mocha'),
path = require('path');
var errors = 0,
testDir = path.dirname(__dirname),
grep = process.argv[2];
var files = [ testDir + '/basic.js' ];
var files = fs.readdirSync(testDir)
.filter(function(name) { return (/.*\.js$/).test(name); })
.map(function(name) { return testDir + path.sep + name; });
run('./node', function() {
run('./browser', function() {
run('./runtime', function() {
/*eslint-disable no-process-exit */
process.exit(errors);
/*eslint-enable no-process-exit */
});
});
});
function run(env, callback) {
var mocha = new Mocha();
mocha.ui('bdd');
mocha.reporter('dot');
mocha.files = files.slice();
if (grep) {
mocha.grep(grep);
}
files.forEach(function(name) {
delete require.cache[name];
});
console.log('Running env: ' + env);
require(env);
mocha.run(function(errorCount) {
errors += errorCount;
callback();
});
}