aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-03-20 16:27:16 +0100
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-03-20 16:49:40 +0100
commitdca0f6b36622162286f8a880e0ae73d509e53825 (patch)
treecbddcf8a2ab53478d3b240b1e2c7cdb958c65f5a
parent90431143eb37efe5bc25a5ffb414d0db97bf1ce9 (diff)
downloadsonarqube-dca0f6b36622162286f8a880e0ae73d509e53825.tar.gz
sonarqube-dca0f6b36622162286f8a880e0ae73d509e53825.zip
Run JS tests on maven test phase
-rw-r--r--sonar-server/Gruntfile.coffee7
-rw-r--r--sonar-server/karma.conf.js6
-rw-r--r--sonar-server/package.json6
-rw-r--r--sonar-server/pom.xml10
4 files changed, 22 insertions, 7 deletions
diff --git a/sonar-server/Gruntfile.coffee b/sonar-server/Gruntfile.coffee
index 82177d73582..c7700324e70 100644
--- a/sonar-server/Gruntfile.coffee
+++ b/sonar-server/Gruntfile.coffee
@@ -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
diff --git a/sonar-server/karma.conf.js b/sonar-server/karma.conf.js
index 09d37706938..de6a2a042a2 100644
--- a/sonar-server/karma.conf.js
+++ b/sonar-server/karma.conf.js
@@ -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/'
},
diff --git a/sonar-server/package.json b/sonar-server/package.json
index e6c05471709..2c134ac257e 100644
--- a/sonar-server/package.json
+++ b/sonar-server/package.json
@@ -14,13 +14,11 @@
"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/"
}
diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml
index 381eeea2856..692b3198e11 100644
--- a/sonar-server/pom.xml
+++ b/sonar-server/pom.xml
@@ -280,6 +280,16 @@
</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>
<goals>