Explorar o código

use Grunt to execute tests with 'grunt test'

Manfred Kroehnert %!s(int64=11) %!d(string=hai) anos
pai
achega
e338f3062f
Modificáronse 2 ficheiros con 23 adicións e 7 borrados
  1. 20 6
      root/Gruntfile.js
  2. 3 1
      template.js

+ 20 - 6
root/Gruntfile.js

@@ -3,6 +3,15 @@
 module.exports = function(grunt) {
   var path = require('path');
 
+  // These plugins provide necessary tasks.
+  grunt.loadNpmTasks('grunt-contrib-clean');
+  grunt.loadNpmTasks('grunt-execute');
+  grunt.loadNpmTasks('amber-dev');
+
+  // Default task.
+  //grunt.registerTask('default', ['']);
+  grunt.registerTask('test', ['amberc:test_runner', 'execute:test_runner_run', 'clean:test_runner_clean']);
+
   // Project configuration.
   grunt.initConfig({
     // Metadata.
@@ -12,6 +21,7 @@ module.exports = function(grunt) {
       '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
       '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
       ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
+    // task configuration
     amberc: {
       options: {
         amber_dir: path.join(__dirname, "bower_components", "amber"),
@@ -29,13 +39,17 @@ module.exports = function(grunt) {
         main_class: 'NodeTestRunner',
         output_name: 'test_runner'
       }
+    },
+
+    execute: {
+      test_runner_run: {
+        src: ['test_runner.js']
+      }
+    },
+
+    clean: {
+      test_runner_clean: ['test_runner.js']
     }
-    // Task configuration.
   });
 
-  // These plugins provide necessary tasks.
-  grunt.loadNpmTasks('amber-dev');
-
-  // Default task.
-  //grunt.registerTask('default', ['']);
 };

+ 3 - 1
template.js

@@ -76,11 +76,13 @@ exports.template = function(grunt, init, done) {
     props.keywords = ['Amber', 'Smalltalk'];
     props.devDependencies = {
       "grunt": "~0.4.0",
+      "grunt-execute": "~0.2.1",
+      "grunt-contrib-clean": "~0.5.0",
       "amber-dev": "0.0.3"
     };
     props.node_version = '>= 0.8.0';
     props.scripts = {
-      "test": "grunt amberc:test_runner && node test_runner.js && ( rm test_runner.js || del test_runner.js )"
+      "test": "grunt test"
     };
 
     // Generate package.json file, used by npm and grunt.