]> source.dussan.org Git - sonarqube.git/commitdiff
Run JS tests on maven test phase
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 20 Mar 2014 15:27:16 +0000 (16:27 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 20 Mar 2014 15:49:40 +0000 (16:49 +0100)
sonar-server/Gruntfile.coffee
sonar-server/karma.conf.js
sonar-server/package.json
sonar-server/pom.xml

index 82177d73582918f85258fd66eb53d5af417337ff..c7700324e702aee8ba8b0cf7d0a50229a86c18d7 100644 (file)
@@ -1,4 +1,5 @@
 module.exports = (grunt) ->
+  grunt.loadNpmTasks('grunt-karma');
   grunt.initConfig
     pkg: grunt.file.readJSON('package.json')
 
@@ -178,6 +179,12 @@ module.exports = (grunt) ->
           ]
 
 
+    karma:
+      unit:
+        configFile: 'karma.conf.js'
+        singleRun: true
+
+
     watch:
       options:
         spawn: false
index 09d37706938f50635b224060b7c5b045c2a02f4e..de6a2a042a2e50701ad53e88bc38228758fcd75b 100644 (file)
@@ -14,7 +14,7 @@ module.exports = function(config) {
   config.set({
 
     // base path, that will be used to resolve files and exclude
-    basePath: 'src/main/webapp/javascripts',
+    basePath: 'src/main/webapp/js',
 
 
     // frameworks to use
@@ -26,7 +26,7 @@ module.exports = function(config) {
         // dependencies
         'third-party/jquery.js',
         'third-party/underscore.js',
-        'third-party/require.js',
+        'require.js',
         'translate.js',
         'common/inputs.js',
 
@@ -76,7 +76,7 @@ module.exports = function(config) {
 
 
     coverageReporter: {
-      type : 'text',
+      type : 'lcovonly',
       dir : '../../../../target/karma/coverage/'
     },
 
index e6c05471709dff986e03c3d93d8c334039d2ca97..2c134ac257e7951720ad4cc6d6d76c32b0555aff 100644 (file)
     "grunt-contrib-handlebars": "^0.7.0",
     "grunt-contrib-requirejs": "^0.4.3",
     "grunt-contrib-watch": "~0.5.3",
-    "grunt-contrib-uglify": "^0.4.0"
+    "grunt-contrib-uglify": "^0.4.0",
+    "grunt-karma": "~0.6.2"
   },
   "engines": {
     "node": "~0.8 || ~0.10"
   },
-  "scripts": {
-    "test": "./node_modules/.bin/karma start --single-run"
-  },
   "assets": "src/main/webapp/"
 }
index 381eeea28560ccea8f66fe4c83531f9e9df3d237..692b3198e1187ca9be176c5f1f93ccc257a155c0 100644 (file)
               <arguments>install</arguments>
             </configuration>
           </execution>
+          <execution>
+            <id>javascript tests</id>
+            <phase>test</phase>
+            <goals>
+              <goal>grunt</goal>
+            </goals>
+            <configuration>
+              <arguments>karma</arguments>
+            </configuration>
+          </execution>
           <execution>
             <phase>generate-resources</phase>
             <id>grunt build</id>