Move test runner into grunt
This commit is contained in:
+14
-1
@@ -1,3 +1,5 @@
|
||||
var childProcess = require('child_process');
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
@@ -68,11 +70,22 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
||||
|
||||
grunt.registerTask('dist-dir', function() {
|
||||
grunt.file.delete('dist');
|
||||
grunt.file.mkdir('dist');
|
||||
});
|
||||
grunt.registerTask('test', function() {
|
||||
var done = this.async();
|
||||
|
||||
var runner = childProcess.fork('./spec/env/runner', [], {stdio: 'inherit'});
|
||||
runner.on('close', function(code) {
|
||||
if (code != 0) {
|
||||
grunt.fatal(code + ' tests failed');
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerTask('default', ['dist-dir', 'concat', 'uglify']);
|
||||
grunt.registerTask('default', ['jshint', 'dist-dir', 'concat', 'uglify', 'test']);
|
||||
};
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ if you've got bundler installed.
|
||||
|
||||
To build Handlebars.js from scratch, you'll want to run `rake build`
|
||||
in the root of the project. That will build Handlebars and output the
|
||||
results to the dist/ folder. To run tests, run `rake spec` or `npm test`.
|
||||
results to the dist/ folder. To run tests, run `grunt test` or `npm test`.
|
||||
You can also run our set of benchmarks with `rake bench`.
|
||||
|
||||
If you notice any problems, please report them to the GitHub issue tracker at
|
||||
|
||||
@@ -26,13 +26,7 @@ end
|
||||
|
||||
task :compile => "lib/handlebars/compiler/parser.js"
|
||||
|
||||
desc "run the spec suite"
|
||||
task :spec => [:build] do
|
||||
rc = system "npm test"
|
||||
fail "npm test failed with exit code #{$?.exitstatus}" if (rc.nil? || ! rc || $?.exitstatus != 0)
|
||||
end
|
||||
|
||||
task :default => [:compile, :spec]
|
||||
task :default => [:build]
|
||||
|
||||
task :build => [:compile] do |task|
|
||||
system "grunt"
|
||||
@@ -65,7 +59,6 @@ task :version, [:version] => [] do |task, args|
|
||||
end
|
||||
|
||||
Rake::Task[:build].invoke
|
||||
Rake::Task[:spec].invoke
|
||||
|
||||
# TODO : Make sure that all of these files are updated properly in git then run npm version
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user