[TASK] Add karma-coverage and karma-junit-reporter 34/48634/3
authorSusanne Moog <susanne.moog@typo3.com>
Wed, 22 Jun 2016 10:35:40 +0000 (12:35 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 23 Jun 2016 11:56:40 +0000 (13:56 +0200)
To get junit compatible results and code coverage
reports that can be understood by CI systems this
patch adds dependencies to karma-coverage and
karma-junit-reporter. It also adds the necessary configuration.

Change-Id: I27ae2e7e6aecf3271d21c1ccff9f8458092cc5e5
Releases: master
Resolves: #76730
Reviewed-on: https://review.typo3.org/48634
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/package.json
typo3/sysext/core/Build/Configuration/JSUnit/karma.conf.js

index d3c12ed..6c2b678 100644 (file)
     "jasmine-core": "^2.4.1",
     "karma": "^0.13.22",
     "karma-chrome-launcher": "^1.0.1",
+    "karma-coverage": "^1.0.0",
     "karma-firefox-launcher": "^1.0.0",
     "karma-ie-launcher": "^1.0.0",
     "karma-jasmine": "^1.0.2",
+    "karma-junit-reporter": "^1.0.0",
     "karma-opera-launcher": "^1.0.0",
     "karma-phantomjs-launcher": "^1.0.0",
     "karma-requirejs": "^1.0.0",
index 173b240..a88894f 100644 (file)
@@ -29,12 +29,25 @@ module.exports = function(config) {
                // preprocess matching files before serving them to the browser
                // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
                preprocessors: {
+                       'typo3/sysext/**/Resources/Public/JavaScript/**/*.js': ['coverage']
                },
 
                // test results reporter to use
-               // possible values: 'dots', 'progress'
+               // possible values: 'dots', 'progress', 'coverage', 'junit'
                // available reporters: https://npmjs.org/browse/keyword/karma-reporter
-               reporters: ['progress'],
+               reporters: ['progress', 'junit', 'coverage'],
+
+               junitReporter: {
+                       outputDir: 'typo3temp/var/tests/',
+                       useBrowserName: false,
+                       outputFile: 'karma.junit.xml'
+               },
+
+               coverageReporter: {
+                       reporters: [
+                               {type: 'clover', dir: 'typo3temp', subdir: 'var/tests', file: 'karma.clover.xml'}
+                       ]
+               },
 
                // web server port
                port: 9876,