From 3b2ffbb1886b78d8c371ec56045f89fbd5c70981 Mon Sep 17 00:00:00 2001 From: Mischa Dasberg Date: Thu, 2 Apr 2015 14:00:45 +0200 Subject: [PATCH] Major refactoring --- CHANGELOG.md | 13 ++ Gruntfile.js | 158 ++++++------- README.md | 171 ++++++++++++-- data/projectx/results/jshint/jshint.xml | 14 ++ .../PhantomJS 1.9.8 (Mac OS X)/base.css | 182 +++++++++++++++ .../coverage-final.json | 2 + .../PhantomJS 1.9.8 (Mac OS X)/index.html | 85 +++++++ .../PhantomJS 1.9.8 (Mac OS X)/lcov.info | 21 ++ .../PhantomJS 1.9.8 (Mac OS X)/prettify.css | 1 + .../PhantomJS 1.9.8 (Mac OS X)/prettify.js | 1 + .../sort-arrow-sprite.png | Bin 0 -> 209 bytes .../PhantomJS 1.9.8 (Mac OS X)/sorter.js | 156 +++++++++++++ .../PhantomJS 1.9.8 (Mac OS X)/src/index.html | 85 +++++++ .../PhantomJS 1.9.8 (Mac OS X)/src/x.js.html | 102 +++++++++ data/projectx/results/karma/results.xml | 18 ++ .../app-two.js => data/projectx/src/x.js | 7 +- data/projectx/test/karma/xSpec.js | 15 ++ data/projecty/results/jshint/jshint.xml | 12 + .../PhantomJS 1.9.8 (Mac OS X)/base.css | 182 +++++++++++++++ .../coverage-final.json | 2 + .../PhantomJS 1.9.8 (Mac OS X)/index.html | 85 +++++++ .../PhantomJS 1.9.8 (Mac OS X)/lcov.info | 12 +- .../PhantomJS 1.9.8 (Mac OS X)/prettify.css | 1 + .../PhantomJS 1.9.8 (Mac OS X)/prettify.js | 1 + .../sort-arrow-sprite.png | Bin 0 -> 209 bytes .../PhantomJS 1.9.8 (Mac OS X)/sorter.js | 156 +++++++++++++ .../PhantomJS 1.9.8 (Mac OS X)/src/index.html | 85 +++++++ .../PhantomJS 1.9.8 (Mac OS X)/src/y.js.html | 102 +++++++++ data/projecty/results/karma/results.xml | 13 ++ .../app-one.js => data/projecty/src/y.js | 7 +- data/projecty/test/karma/ySpec.js | 9 + package.json | 25 ++- results/first/junit.xml | 12 - results/first/lcov.info | 17 -- results/second/junit.xml | 12 - results/second/lcov.info | 17 -- sources/first/test/app-oneSpec.js | 9 - sources/second/test/app-twoSpec.js | 9 - tasks/coverage.js | 44 ++++ tasks/jasmineJunit.js | 97 ++++++++ tasks/karmaSonar.js | 15 ++ tasks/karma_sonar.js | 209 ------------------ tasks/sonar.js | 186 ++++++++++++++++ test/expected/custom_options/TESTS-xunit.xml | 13 -- test/expected/default_options/TESTS-xunit.xml | 25 --- test/expected/sonar-one-path/TESTS-xunit.xml | 19 ++ .../sonar-one-path/coverage_report.lcov | 21 ++ test/expected/sonar-two-paths/TESTS-xunit.xml | 32 +++ .../coverage_report.lcov | 32 ++- test/karmaSonarSpec.js | 180 +++++++++++++++ test/karma_sonar_test.js | 18 +- 51 files changed, 2227 insertions(+), 463 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 data/projectx/results/jshint/jshint.xml create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sort-arrow-sprite.png create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sorter.js create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html create mode 100644 data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/x.js.html create mode 100644 data/projectx/results/karma/results.xml rename sources/second/scripts/app-two.js => data/projectx/src/x.js (50%) create mode 100644 data/projectx/test/karma/xSpec.js create mode 100644 data/projecty/results/jshint/jshint.xml create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html rename test/expected/custom_options/coverage_report.lcov => data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info (56%) create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sort-arrow-sprite.png create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sorter.js create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html create mode 100644 data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/y.js.html create mode 100644 data/projecty/results/karma/results.xml rename sources/first/scripts/app-one.js => data/projecty/src/y.js (52%) create mode 100644 data/projecty/test/karma/ySpec.js delete mode 100644 results/first/junit.xml delete mode 100644 results/first/lcov.info delete mode 100644 results/second/junit.xml delete mode 100644 results/second/lcov.info delete mode 100644 sources/first/test/app-oneSpec.js delete mode 100644 sources/second/test/app-twoSpec.js create mode 100644 tasks/coverage.js create mode 100644 tasks/jasmineJunit.js create mode 100644 tasks/karmaSonar.js delete mode 100644 tasks/karma_sonar.js create mode 100644 tasks/sonar.js delete mode 100644 test/expected/custom_options/TESTS-xunit.xml delete mode 100644 test/expected/default_options/TESTS-xunit.xml create mode 100644 test/expected/sonar-one-path/TESTS-xunit.xml create mode 100644 test/expected/sonar-one-path/coverage_report.lcov create mode 100644 test/expected/sonar-two-paths/TESTS-xunit.xml rename test/expected/{default_options => sonar-two-paths}/coverage_report.lcov (51%) create mode 100644 test/karmaSonarSpec.js diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0bd658d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ + +# 0.1.6 (2015-04-02) + +## Breaking changes +- The configuration has changed. + +## Features +- Added support for dry-run +- Added support for adding custom sonar properties + +## Bug Fixes +- 'karma_sonar' task now stops when an error has occurred +- karma-junit-reporter reports are now processed and updated with the correct spec for classname \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index c96f9ff..2dc3ee2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,103 +8,89 @@ 'use strict'; -module.exports = function(grunt) { +module.exports = function (grunt) { - // Project configuration. - grunt.initConfig({ - jshint: { - all: [ - 'Gruntfile.js', - 'tasks/*.js', - '<%= nodeunit.tests %>' - ], - options: { - jshintrc: '.jshintrc' - } - }, - - // Before generating any new files, remove any previously-created files. - clean: { - tests: ['.tmp'] - }, - - // Configuration to be run (and then tested). - karma_sonar: { - default_options: { - project: { - key: 'grunt-sonar', - name: 'Grunt sonar plugin', - version: '0.1.4' + // Project configuration. + grunt.initConfig({ + jshint: { + all: [ + 'Gruntfile.js', + 'tasks/*.js' + ], + options: { + jshintrc: '.jshintrc' + } }, - sources: [ - { - path: 'sources/first/scripts', - prefix: 'sources/first', - coverageReport: 'results/first/lcov.info', - testReport: 'results/first/junit.xml' + karmaSonar: { + options: { + defaultOutputDir: '.tmp/sonar2', + instance: { + jdbcUrl: 'jdbc:h2:tcp://localhost:9092/sonar' + }, + dryRun: true, + runnerProperties: { + 'sonar.links.homepage': 'https://github.com/mdasberg/grunt-karma-sonar', + 'sonar.branch': 'master' + } }, - { - path: 'sources/second/scripts', - prefix: 'sources/second', - coverageReport: 'results/second/lcov.info', - testReport: 'results/second/junit.xml' - } - ], - exclusions: [] - }, - custom_options: { - options: { - defaultOutputDir: '.tmp/sonar/custom_options/', - instance: { - hostUrl : 'http://localhost:20001', - jdbcUrl : 'jdbc:h2:tcp://localhost:20003/sonar', - jdbcUsername: 'sonar', - jdbcPassword: 'sonar', - login: 'admin', - password: 'admin' + all: { + project: { + key: 'grunt-karma-sonar', + name: 'Grunt-karma-sonar plugin', + version: '0.2.0' + }, + paths: [ + { + cwd: 'data/projectx', + src: 'src', + test: 'test', + reports: { + unit: 'results/karma/results.xml', + coverage: 'results/karma/coverage/**/lcov.info' + } + }, + { + cwd: 'data/projecty', + src: 'src', + test: 'test', + reports: { + unit: 'results/karma/results.xml', + coverage: 'results/karma/coverage/**/lcov.info' + } + } + + ] } }, - project: { - key: 'grunt-sonar', - name: 'Grunt sonar plugin', - version: '0.1.4' + + // Before generating any new files, remove any previously-created files. + clean: { + tests: ['.tmp'] }, - sources: [ - { - path: 'sources/first/scripts', - prefix: 'sources/first', - testReport: 'results/first/junit.xml' - }, - { - path: 'sources/second/scripts', - prefix: 'sources/second', - coverageReport: 'results/second/lcov.info' + shell: { + target: { + command: 'node_modules/jasmine-node/bin/jasmine-node test/*Spec.js' } - ], - exclusions: [] + } } - }, - - // Unit tests. - nodeunit: { - tests: ['test/*_test.js'] - } - }); + ) + ; - // Actually load this plugin's task(s). - grunt.loadTasks('tasks'); +// Actually load this plugin's task(s). + grunt.loadTasks('tasks'); - // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-nodeunit'); +// These plugins provide necessary tasks. + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-shell'); - // Whenever the "test" task is run, first clean the "tmp" dir, then run this - // plugin's task(s), then test the result. - grunt.registerTask('test', ['clean', 'karma_sonar', 'nodeunit']); +// Whenever the "test" task is run, first clean the "tmp" dir, then run this +// plugin's task(s), then test the result. + grunt.registerTask('test', ['clean', 'shell']); - // By default, lint and run all tests. - grunt.registerTask('default', ['jshint', 'test']); +// By default, lint and run all tests. + grunt.registerTask('default', ['jshint', 'test']); -}; +} +; diff --git a/README.md b/README.md index 7fd925c..fa42048 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ > Grunt plugin for integrating karma reports with sonar ## Getting Started -This plugin requires Grunt `~0.4.1` +This plugin requires Grunt `~0.4.5` If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: @@ -37,46 +37,177 @@ grunt.initConfig({ ### Options -#### options.separator +#### options.dynamicAnalysis Type: `String` -Default value: `', '` +Default: 'reuseReports' -A string value that is used to do something with whatever. +Should be the sonar.property dynamicAnalysis -#### options.punctuation +#### options.sourceEncoding Type: `String` -Default value: `'.'` +Default: 'UTF-8' -A string value that is used to do something else with whatever else. +Should be the sonar.property sourceEncoding + +#### options.language +Type: `String` +Default: 'js' + +Should be the sonar.property language + +#### options.scmDisabled +Type: `String` +Default: 'true' + +Should be the sonar.property scmDisabled + +#### options.defaultOutputDir +Type: `String` +Default: '.tmp/sonar/' + +Should be the location where the karmaSonar plugin will put it's temporary files. + +#### options.instance.hostUrl +Type: `String` +Default: 'http://localhost:9000' + +Should be the sonar.property host.url + +#### options.instance.jdbcUrl +Type: `String` +Default: 'jdbc:h2:tcp://localhost:9092/sonar' + +Should be the sonar.property jdbc.url + +#### options.instance.jdbcUsername +Type: `String` +Default: 'sonar' + +Should be the sonar.property jdbc.username + +#### options.instance.jdbcPassword +Type: `String` +Default: 'sonar' + +Should be the sonar.property jdbc.password + +#### options.instance.login +Type: `String` +Default: 'admin' + +Should be the sonar.property login + +#### options.instance.password +Type: `String` +Default: 'admin' + +Should be the sonar.property password + +#### options.instance.runnerProperties +Type: `Object` + +Should be the list of key(`sonar key`) value pairs. + +```js +runnerProperties: { + 'sonar.links.homepage': 'https://github.com/mdasberg/grunt-karma-sonar', + 'sonar.branch': 'master' +} +``` + +#### project +Type: `Object`, +Mandatory: true + +Should be the project information for sonar + +#### project.key +Type: `String` +Mandatory: true` + +Should be the project key for sonar + +#### project.name +Type: `String` +Mandatory: true` + +Should be the project name for sonar + +#### project.version +Type: `String` + +Should be the project version for sonar + +#### paths +Type: `Array` + +Should be the paths that contain the code, tests and results + +#### paths[].cwd +Type: `String` +Default: '.' + +Should be the current working directory that contain the source, tests and results folders are located + +#### paths[].src +Type: `String` + +Should be the directory containing the sources within the cwd. + +#### paths[].test +Type: `String` + +Should be the directory containing the tests within the cwd. + +#### paths[].reports +Type: `Object` + +Should be the object containing the reports. + +#### paths[].reports.unit +Type: `String` + +Should be the location of the karma-junit-reporter report within the cwd. + +#### paths[].reports.coverage +Type: `String` + +Should be the glob for the lcov.info files within the cwd. ### Usage Examples #### Default Options -In this example, the default options are used to do something with whatever. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result would be `Testing, 1 2 3.` ```js grunt.initConfig({ karma_sonar: { - options: {}, + options: { + + }, your_target: { project: { key: 'grunt-sonar', name: 'Grunt sonar plugin', version: '0.1.1' }, - sources: [ + paths: [ { - path: '...', - prefix: '...', // karma path in lcov files is incorrect, you can use prefix to fix this. - coverageReport: '.../path/to/lcov.info', - testReport: '.../path/to/junit.xml' + cwd: '...', // the current working directory' + src: '...', // the source directory within the cwd + test: '...', // the test directory within the cwd + reports: { + unit: '../path/result.xml', // the result file within the cwd + coverage: '../path/**/lcov.info' // the glob for lcov files' + } }, { - path: '...', - prefix: '...', // karma path in lcov files is incorrect, you can use prefix to fix this. - coverageReport: '.../path/to/lcov.info', - testReport: '.../path/to/junit.xml' - } + cwd: '...', // the current working directory' + src: '...', // the source directory within the cwd + test: '...', // the test directory within the cwd + reports: { + unit: '../path/result.xml', // the result file within the cwd + coverage: '../path/**/lcov.info' // the glob for lcov files' + } ], exclusions: [] } @@ -105,7 +236,7 @@ grunt.initConfig({ name: 'Grunt sonar plugin', version: '0.1.1' }, - sources: [...], + paths: [...], exclusions: [] } } diff --git a/data/projectx/results/jshint/jshint.xml b/data/projectx/results/jshint/jshint.xml new file mode 100644 index 0000000..6cbfdec --- /dev/null +++ b/data/projectx/results/jshint/jshint.xml @@ -0,0 +1,14 @@ + + + + +1. line 2, char 5: Missing "use strict" statement. +2. line 7, char 35: Missing "use strict" statement. +3. line 11, char 37: Missing "use strict" statement. +4. line 2, char 5: 'who' is not defined. +5. line 7, char 27: 'who' is not defined. +6. line 11, char 29: 'who' is not defined. +7. line 1, char 10: 'App' is defined but never used. + + + diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css new file mode 100644 index 0000000..7fb8827 --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css @@ -0,0 +1,182 @@ +body, html { + margin:0; padding: 0; +} +body { + font-family: Helvetica Neue, Helvetica,Arial; + font-size: 10pt; +} +div.header, div.footer { + background: #eee; + padding: 1em; +} +div.header { + z-index: 100; + position: fixed; + top: 0; + border-bottom: 1px solid #666; + width: 100%; +} +div.footer { + border-top: 1px solid #666; +} +div.body { + margin-top: 10em; +} +div.meta { + font-size: 90%; + text-align: center; +} +h1, h2, h3 { + font-weight: normal; +} +h1 { + font-size: 12pt; +} +h2 { + font-size: 10pt; +} +pre { + font-family: Consolas, Menlo, Monaco, monospace; + margin: 0; + padding: 0; + line-height: 14px; + font-size: 14px; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} + +div.path { font-size: 110%; } +div.path a:link, div.path a:visited { color: #000; } +table.coverage { border-collapse: collapse; margin:0; padding: 0 } + +table.coverage td { + margin: 0; + padding: 0; + color: #111; + vertical-align: top; +} +table.coverage td.line-count { + width: 50px; + text-align: right; + padding-right: 5px; +} +table.coverage td.line-coverage { + color: #777 !important; + text-align: right; + border-left: 1px solid #666; + border-right: 1px solid #666; +} + +table.coverage td.text { +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 40px; +} +table.coverage td span.cline-neutral { + background: #eee; +} +table.coverage td span.cline-yes { + background: #b5d592; + color: #999; +} +table.coverage td span.cline-no { + background: #fc8c84; +} + +.cstat-yes { color: #111; } +.cstat-no { background: #fc8c84; color: #111; } +.fstat-no { background: #ffc520; color: #111 !important; } +.cbranch-no { background: yellow !important; color: #111; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +.missing-if-branch { + display: inline-block; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: black; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} + +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} + +.entity, .metric { font-weight: bold; } +.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } +.metric small { font-size: 80%; font-weight: normal; color: #666; } + +div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } +div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } +div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } +div.coverage-summary th.file { border-right: none !important; } +div.coverage-summary th.pic { border-left: none !important; text-align: right; } +div.coverage-summary th.pct { border-right: none !important; } +div.coverage-summary th.abs { border-left: none !important; text-align: right; } +div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } +div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } +div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } +div.coverage-summary td.pic { min-width: 120px !important; } +div.coverage-summary a:link { text-decoration: none; color: #000; } +div.coverage-summary a:visited { text-decoration: none; color: #333; } +div.coverage-summary a:hover { text-decoration: underline; } +div.coverage-summary tfoot td { border-top: 1px solid #666; } + +div.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +div.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +div.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} + +.high { background: #b5d592 !important; } +.medium { background: #ffe87c !important; } +.low { background: #fc8c84 !important; } + +span.cover-fill, span.cover-empty { + display:inline-block; + border:1px solid #444; + background: white; + height: 12px; +} +span.cover-fill { + background: #ccc; + border-right: 1px solid #444; +} +span.cover-empty { + background: white; + border-left: none; +} +span.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } \ No newline at end of file diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json new file mode 100644 index 0000000..07532a7 --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json @@ -0,0 +1,2 @@ +{ +"./projectx/src/x.js":{"path":"./projectx/src/x.js","s":{"1":1,"2":2,"3":2,"4":1,"5":2,"6":1},"b":{},"f":{"1":2,"2":1,"3":1},"fnMap":{"1":{"name":"App","line":1,"loc":{"start":{"line":1,"column":-15},"end":{"line":1,"column":15}}},"2":{"name":"(anonymous_2)","line":6,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":28}}},"3":{"name":"(anonymous_3)","line":10,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":30}}}},"statementMap":{"1":{"start":{"line":1,"column":-15},"end":{"line":14,"column":1}},"2":{"start":{"line":2,"column":4},"end":{"line":4,"column":6}},"3":{"start":{"line":6,"column":4},"end":{"line":8,"column":5}},"4":{"start":{"line":7,"column":8},"end":{"line":7,"column":35}},"5":{"start":{"line":10,"column":4},"end":{"line":13,"column":5}},"6":{"start":{"line":11,"column":8},"end":{"line":11,"column":37}}},"branchMap":{},"l":{"1":1,"2":2,"6":2,"7":1,"10":2,"11":1}}} diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html new file mode 100644 index 0000000..191b223 --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html @@ -0,0 +1,85 @@ + + + + Code coverage report for All files + + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 100% (6 / 6)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (3 / 3)      + + + Lines: 100% (6 / 6)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
src/100%(6 / 6)100%(0 / 0)100%(3 / 3)100%(6 / 6)
+
+
+ + + + + + + + diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info new file mode 100644 index 0000000..75e3e2c --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info @@ -0,0 +1,21 @@ +TN: +SF:./projectx/src/x.js +FN:1,App +FN:6,(anonymous_2) +FN:10,(anonymous_3) +FNF:3 +FNH:3 +FNDA:2,App +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +DA:1,1 +DA:2,2 +DA:6,2 +DA:7,1 +DA:10,2 +DA:11,1 +LF:6 +LH:6 +BRF:0 +BRH:0 +end_of_record diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sort-arrow-sprite.png b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sort-arrow-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..03f704a609c6fd0dbfdac63466a7d7c958b5cbf3 GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bd!3HEZxJ@+%Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jii$m5978H@?Fn+^JD|Y9yzj{W`447Gxa{7*dM7nnnD-Lb z6^}Hx2)'; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html new file mode 100644 index 0000000..58474d3 --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html @@ -0,0 +1,85 @@ + + + + Code coverage report for src/ + + + + + + + + +
+

Code coverage report for src/

+

+ + Statements: 100% (6 / 6)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (3 / 3)      + + + Lines: 100% (6 / 6)      + + Ignored: none      +

+
All files » src/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
x.js100%(6 / 6)100%(0 / 0)100%(3 / 3)100%(6 / 6)
+
+
+ + + + + + + + diff --git a/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/x.js.html b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/x.js.html new file mode 100644 index 0000000..9472683 --- /dev/null +++ b/data/projectx/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/x.js.html @@ -0,0 +1,102 @@ + + + + Code coverage report for src/x.js + + + + + + + + +
+

Code coverage report for src/x.js

+

+ + Statements: 100% (6 / 6)      + + + Branches: 100% (0 / 0)      + + + Functions: 100% (3 / 3)      + + + Lines: 100% (6 / 6)      + + Ignored: none      +

+
All files » src/ » x.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +161 +2 +  +  +  +2 +1 +  +  +2 +1 +  +  +  +  + 
function App() {
+    who = {
+        name: 'x app'
+    };
+ 
+    this.hello = function() {
+        return 'hello ' + who.name;
+    }
+    
+    this.goodbye = function() {
+        return 'goodbye ' + who.name;
+        
+    }
+}
+ 
+ 
+ +
+ + + + + + + + diff --git a/data/projectx/results/karma/results.xml b/data/projectx/results/karma/results.xml new file mode 100644 index 0000000..f82d2a3 --- /dev/null +++ b/data/projectx/results/karma/results.xml @@ -0,0 +1,18 @@ + + + + + + + + + Expected 'goodbye x app' to be 'hello x app'. + at /Users/mischa/workspace/karma-example/projectx/test/karma/xSpec.js:12 + + + + + + diff --git a/sources/second/scripts/app-two.js b/data/projectx/src/x.js similarity index 50% rename from sources/second/scripts/app-two.js rename to data/projectx/src/x.js index 10433b9..a6e92a1 100644 --- a/sources/second/scripts/app-two.js +++ b/data/projectx/src/x.js @@ -1,10 +1,15 @@ function App() { who = { - name: 'second app' + name: 'x app' }; this.hello = function() { return 'hello ' + who.name; } + + this.goodbye = function() { + return 'goodbye ' + who.name; + + } } diff --git a/data/projectx/test/karma/xSpec.js b/data/projectx/test/karma/xSpec.js new file mode 100644 index 0000000..cc92dce --- /dev/null +++ b/data/projectx/test/karma/xSpec.js @@ -0,0 +1,15 @@ +'use strict'; + +/* jasmine specs for the first app. */ +describe('Project X', function () { + + it("should say hello x app", function () { + expect(new App().hello()).toBe('hello x app'); + }); + + describe('And', function() { + it("should say goodbye x app", function () { + expect(new App().goodbye()).toBe('hello x app'); + }); + }) +}); diff --git a/data/projecty/results/jshint/jshint.xml b/data/projecty/results/jshint/jshint.xml new file mode 100644 index 0000000..7529964 --- /dev/null +++ b/data/projecty/results/jshint/jshint.xml @@ -0,0 +1,12 @@ + + + + +1. line 2, char 5: Missing "use strict" statement. +2. line 7, char 35: Missing "use strict" statement. +3. line 2, char 5: 'who' is not defined. +4. line 7, char 27: 'who' is not defined. +5. line 1, char 10: 'App' is defined but never used. + + + diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css new file mode 100644 index 0000000..7fb8827 --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/base.css @@ -0,0 +1,182 @@ +body, html { + margin:0; padding: 0; +} +body { + font-family: Helvetica Neue, Helvetica,Arial; + font-size: 10pt; +} +div.header, div.footer { + background: #eee; + padding: 1em; +} +div.header { + z-index: 100; + position: fixed; + top: 0; + border-bottom: 1px solid #666; + width: 100%; +} +div.footer { + border-top: 1px solid #666; +} +div.body { + margin-top: 10em; +} +div.meta { + font-size: 90%; + text-align: center; +} +h1, h2, h3 { + font-weight: normal; +} +h1 { + font-size: 12pt; +} +h2 { + font-size: 10pt; +} +pre { + font-family: Consolas, Menlo, Monaco, monospace; + margin: 0; + padding: 0; + line-height: 14px; + font-size: 14px; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} + +div.path { font-size: 110%; } +div.path a:link, div.path a:visited { color: #000; } +table.coverage { border-collapse: collapse; margin:0; padding: 0 } + +table.coverage td { + margin: 0; + padding: 0; + color: #111; + vertical-align: top; +} +table.coverage td.line-count { + width: 50px; + text-align: right; + padding-right: 5px; +} +table.coverage td.line-coverage { + color: #777 !important; + text-align: right; + border-left: 1px solid #666; + border-right: 1px solid #666; +} + +table.coverage td.text { +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 40px; +} +table.coverage td span.cline-neutral { + background: #eee; +} +table.coverage td span.cline-yes { + background: #b5d592; + color: #999; +} +table.coverage td span.cline-no { + background: #fc8c84; +} + +.cstat-yes { color: #111; } +.cstat-no { background: #fc8c84; color: #111; } +.fstat-no { background: #ffc520; color: #111 !important; } +.cbranch-no { background: yellow !important; color: #111; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +.missing-if-branch { + display: inline-block; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: black; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} + +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} + +.entity, .metric { font-weight: bold; } +.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } +.metric small { font-size: 80%; font-weight: normal; color: #666; } + +div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } +div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } +div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } +div.coverage-summary th.file { border-right: none !important; } +div.coverage-summary th.pic { border-left: none !important; text-align: right; } +div.coverage-summary th.pct { border-right: none !important; } +div.coverage-summary th.abs { border-left: none !important; text-align: right; } +div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } +div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } +div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } +div.coverage-summary td.pic { min-width: 120px !important; } +div.coverage-summary a:link { text-decoration: none; color: #000; } +div.coverage-summary a:visited { text-decoration: none; color: #333; } +div.coverage-summary a:hover { text-decoration: underline; } +div.coverage-summary tfoot td { border-top: 1px solid #666; } + +div.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +div.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +div.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} + +.high { background: #b5d592 !important; } +.medium { background: #ffe87c !important; } +.low { background: #fc8c84 !important; } + +span.cover-fill, span.cover-empty { + display:inline-block; + border:1px solid #444; + background: white; + height: 12px; +} +span.cover-fill { + background: #ccc; + border-right: 1px solid #444; +} +span.cover-empty { + background: white; + border-left: none; +} +span.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } \ No newline at end of file diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json new file mode 100644 index 0000000..5bbbd05 --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/coverage-final.json @@ -0,0 +1,2 @@ +{ +"./projecty/src/y.js":{"path":"./projecty/src/y.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":0},"b":{},"f":{"1":1,"2":1,"3":0},"fnMap":{"1":{"name":"App","line":1,"loc":{"start":{"line":1,"column":-15},"end":{"line":1,"column":15}}},"2":{"name":"(anonymous_2)","line":6,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":28}}},"3":{"name":"(anonymous_3)","line":10,"loc":{"start":{"line":10,"column":19},"end":{"line":10,"column":30}}}},"statementMap":{"1":{"start":{"line":1,"column":-15},"end":{"line":14,"column":1}},"2":{"start":{"line":2,"column":4},"end":{"line":4,"column":6}},"3":{"start":{"line":6,"column":4},"end":{"line":8,"column":5}},"4":{"start":{"line":7,"column":8},"end":{"line":7,"column":35}},"5":{"start":{"line":10,"column":4},"end":{"line":13,"column":5}},"6":{"start":{"line":11,"column":8},"end":{"line":11,"column":37}}},"branchMap":{},"l":{"1":1,"2":1,"6":1,"7":1,"10":1,"11":0}}} diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html new file mode 100644 index 0000000..91326ed --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/index.html @@ -0,0 +1,85 @@ + + + + Code coverage report for All files + + + + + + + + +
+

Code coverage report for All files

+

+ + Statements: 83.33% (5 / 6)      + + + Branches: 100% (0 / 0)      + + + Functions: 66.67% (2 / 3)      + + + Lines: 83.33% (5 / 6)      + + Ignored: none      +

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
src/83.33%(5 / 6)100%(0 / 0)66.67%(2 / 3)83.33%(5 / 6)
+
+
+ + + + + + + + diff --git a/test/expected/custom_options/coverage_report.lcov b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info similarity index 56% rename from test/expected/custom_options/coverage_report.lcov rename to data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info index b4073da..e06335e 100644 --- a/test/expected/custom_options/coverage_report.lcov +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/lcov.info @@ -1,17 +1,21 @@ TN: -SF:sources/second/scripts/app-two.js +SF:./projecty/src/y.js FN:1,App FN:6,(anonymous_2) -FNF:2 +FN:10,(anonymous_3) +FNF:3 FNH:2 FNDA:1,App FNDA:1,(anonymous_2) +FNDA:0,(anonymous_3) DA:1,1 DA:2,1 DA:6,1 DA:7,1 -LF:4 -LH:4 +DA:10,1 +DA:11,0 +LF:6 +LH:5 BRF:0 BRH:0 end_of_record diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sort-arrow-sprite.png b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/sort-arrow-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..03f704a609c6fd0dbfdac63466a7d7c958b5cbf3 GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bd!3HEZxJ@+%Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jii$m5978H@?Fn+^JD|Y9yzj{W`447Gxa{7*dM7nnnD-Lb z6^}Hx2)'; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html new file mode 100644 index 0000000..139cd22 --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/index.html @@ -0,0 +1,85 @@ + + + + Code coverage report for src/ + + + + + + + + +
+

Code coverage report for src/

+

+ + Statements: 83.33% (5 / 6)      + + + Branches: 100% (0 / 0)      + + + Functions: 66.67% (2 / 3)      + + + Lines: 83.33% (5 / 6)      + + Ignored: none      +

+
All files » src/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
y.js83.33%(5 / 6)100%(0 / 0)66.67%(2 / 3)83.33%(5 / 6)
+
+
+ + + + + + + + diff --git a/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/y.js.html b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/y.js.html new file mode 100644 index 0000000..f7319fe --- /dev/null +++ b/data/projecty/results/karma/coverage/PhantomJS 1.9.8 (Mac OS X)/src/y.js.html @@ -0,0 +1,102 @@ + + + + Code coverage report for src/y.js + + + + + + + + +
+

Code coverage report for src/y.js

+

+ + Statements: 83.33% (5 / 6)      + + + Branches: 100% (0 / 0)      + + + Functions: 66.67% (2 / 3)      + + + Lines: 83.33% (5 / 6)      + + Ignored: none      +

+
All files » src/ » y.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +161 +1 +  +  +  +1 +1 +  +  +1 +  +  +  +  +  + 
function App() {
+    who = {
+        name: 'y app'
+    };
+ 
+    this.hello = function() {
+        return 'hello ' + who.name;
+    }
+ 
+    this.goodbye = function() {
+        return 'goodbye ' + who.name;
+ 
+    }
+}
+ 
+ 
+ +
+ + + + + + + + diff --git a/data/projecty/results/karma/results.xml b/data/projecty/results/karma/results.xml new file mode 100644 index 0000000..53b9f0d --- /dev/null +++ b/data/projecty/results/karma/results.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/sources/first/scripts/app-one.js b/data/projecty/src/y.js similarity index 52% rename from sources/first/scripts/app-one.js rename to data/projecty/src/y.js index 247756d..cdeeca0 100644 --- a/sources/first/scripts/app-one.js +++ b/data/projecty/src/y.js @@ -1,10 +1,15 @@ function App() { who = { - name: 'first app' + name: 'y app' }; this.hello = function() { return 'hello ' + who.name; } + + this.goodbye = function() { + return 'goodbye ' + who.name; + + } } diff --git a/data/projecty/test/karma/ySpec.js b/data/projecty/test/karma/ySpec.js new file mode 100644 index 0000000..99b51ac --- /dev/null +++ b/data/projecty/test/karma/ySpec.js @@ -0,0 +1,9 @@ +'use strict'; + +/* jasmine specs for the y app. */ +describe('Project Y', function () { + + it("should return hello y app", function () { + expect(new App().hello()).toBe('hello y app'); + }); +}); diff --git a/package.json b/package.json index e63fd1e..53c9988 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-karma-sonar", "description": "Grunt plugin for integrating karma reports with sonar", - "version": "0.1.5", + "version": "0.2.0", "homepage": "https://github.com/mdasberg/grunt-karma-sonar", "author": { "name": "Mischa Dasberg", @@ -28,15 +28,26 @@ "test": "grunt test" }, "devDependencies": { - "grunt-contrib-jshint": "~0.6.0", - "grunt-contrib-clean": "~0.4.0", - "grunt-contrib-nodeunit": "~0.2.0", - "grunt": "~0.4.1" + "buffer-equal": "0.0.1", + "fs": "0.0.2", + "fs-extra": "^0.18.0", + "grunt": "~0.4.5", + "grunt-contrib-clean": "^0.5.0", + "grunt-contrib-jshint": "^0.9.2", + "grunt-shell": "^1.1.2", + "gruntmock": "^0.1.1", + "jasmine-node": "^1.14.5" }, "peerDependencies": { - "grunt": "~0.4.1" + "grunt": "~0.4.5" }, "keywords": [ "gruntplugin" - ] + ], + "dependencies": { + "async": "^0.9.0", + "glob": "^5.0.3", + "lodash": "^3.6.0", + "path": "^0.11.14" + } } diff --git a/results/first/junit.xml b/results/first/junit.xml deleted file mode 100644 index 68905dc..0000000 --- a/results/first/junit.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/results/first/lcov.info b/results/first/lcov.info deleted file mode 100644 index c9f567e..0000000 --- a/results/first/lcov.info +++ /dev/null @@ -1,17 +0,0 @@ -TN: -SF:./scripts/app-one.js -FN:1,App -FN:6,(anonymous_2) -FNF:2 -FNH:2 -FNDA:1,App -FNDA:1,(anonymous_2) -DA:1,1 -DA:2,1 -DA:6,1 -DA:7,1 -LF:4 -LH:4 -BRF:0 -BRH:0 -end_of_record \ No newline at end of file diff --git a/results/second/junit.xml b/results/second/junit.xml deleted file mode 100644 index 8023600..0000000 --- a/results/second/junit.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/results/second/lcov.info b/results/second/lcov.info deleted file mode 100644 index d202e1f..0000000 --- a/results/second/lcov.info +++ /dev/null @@ -1,17 +0,0 @@ -TN: -SF:./scripts/app-two.js -FN:1,App -FN:6,(anonymous_2) -FNF:2 -FNH:2 -FNDA:1,App -FNDA:1,(anonymous_2) -DA:1,1 -DA:2,1 -DA:6,1 -DA:7,1 -LF:4 -LH:4 -BRF:0 -BRH:0 -end_of_record \ No newline at end of file diff --git a/sources/first/test/app-oneSpec.js b/sources/first/test/app-oneSpec.js deleted file mode 100644 index 2e3d101..0000000 --- a/sources/first/test/app-oneSpec.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -/* jasmine specs for the first app. */ -describe('First app', function () { - - it("should return hello first app", function () { - expect(new App().hello()).toBe('hello first app'); - }); -}); diff --git a/sources/second/test/app-twoSpec.js b/sources/second/test/app-twoSpec.js deleted file mode 100644 index 4762851..0000000 --- a/sources/second/test/app-twoSpec.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -/* jasmine specs for the second app. */ -describe('Second app', function () { - - it("should return hello second app", function () { - expect(new App().hello()).toBe('hello second app'); - }); -}); diff --git a/tasks/coverage.js b/tasks/coverage.js new file mode 100644 index 0000000..680dcdb --- /dev/null +++ b/tasks/coverage.js @@ -0,0 +1,44 @@ +'use strict'; + +(function () { + var coverage = {}, + glob = require("glob"), + grunt = require('grunt'), + path = require('path'); + + /** + * Merge all coverage results. + * Because the sources will be copied we need to fix the paths for coverage + * + * #1 iterate over each location . + * #2 replace the suffix + * #3 append the tests to the result. + * #4 write merged results to file. + */ + coverage.merge = function (locations, outputFile) { + var CURRENT_PATH = '.', + resultContent = ''; + + // #1 + locations.forEach(function (l) { + var cwd = (l.cwd || CURRENT_PATH) + path.sep; + + if (l.reports.coverage) { + glob.sync(l.reports.coverage, {cwd: cwd, root: '/'}).forEach(function (file) { + // #2 + var content = grunt.file.read(cwd + file). + replace(new RegExp('(SF:)(.*' + l.src + ')(.*)', 'g'), '$1.' + path.sep + 'src$3'); + + // #3 + resultContent = resultContent.concat(content); + }); + } else { + grunt.log.warn('No coverage report has been specified'); + } + }); + // #4 + grunt.file.write(outputFile, resultContent); + }; + + module.exports = coverage; +})(); \ No newline at end of file diff --git a/tasks/jasmineJunit.js b/tasks/jasmineJunit.js new file mode 100644 index 0000000..81c0eb1 --- /dev/null +++ b/tasks/jasmineJunit.js @@ -0,0 +1,97 @@ +'use strict'; + +(function () { + var jasmineJUnit = {}, + glob = require("glob"), + grunt = require('grunt'), + path = require('path'), + _ = require('lodash'); + + /** + * Merge all junit results. + * Because the karma-junit-reporter does not use the name of the spec file for the classname, the + * results need to be updated with the correct classname. + * + * #1 iterate over each location . + * #2 iterate over each file and check if there are jasmine tests by checking for it(). + * #3 add all the jasmine tests to the array. + * #4 remove wrapper markup. + * #5 replace the classname with the spec filename. + * #6 append the tests to the result. + * #7 write merged results to file. + */ + jasmineJUnit.merge = function (locations, outputFile) { + + var specs = [], + CURRENT_PATH = '.', + PREFIX = '', + SUFFIX = '', + JASMINE_TESTCASE_REGEX = /it\s?\(\"([^\"]*)\"/g, + SUREFIRE_TESTCASE_REGEX = /(\)/g, + SUREFIRE_TESTCASE_NAME_REGEX = /\bname=\"([^\"]*)/, + resultContent = PREFIX; + + // #1 + locations.forEach(function (l) { + + var cwd = (l.cwd || CURRENT_PATH) + path.sep, + testDir = cwd + l.test, + testDirExists = grunt.file.exists(testDir), + reportFile = cwd + l.reports.unit, + reportFileExists = grunt.file.exists(reportFile); + if (l.test && testDirExists) { + if (l.reports.unit && reportFileExists) { + // #2 + glob.sync('**/*.js', {cwd: testDir, root: '/'}).forEach(function (file) { + var tests = [], + content = grunt.file.read(testDir + path.sep + file), + matches = content.match(JASMINE_TESTCASE_REGEX); + + // #3 + for (var i = 0, len = matches.length; i < len; i++) { + tests.push(matches[i].replace(JASMINE_TESTCASE_REGEX, '$1')); + } + specs.push({ + 'name': path.basename(file, path.extname(file)), + 'tests': tests + }); + }); + + // #4 + var content = grunt.file.read(reportFile). + replace(/\<\?xml.+\?\>/g, ''). + replace(/\/g, ''). + replace(/\<\/testsuites>/g, ''); + + // #5 + var matches = content.match(SUREFIRE_TESTCASE_REGEX); + for (var i = 0, len = matches.length; i < len; i++) { + var name = SUREFIRE_TESTCASE_NAME_REGEX.exec(matches[i])[1]; + var spec = _.pluck(_.filter(specs, function (spec) { + return _.find(spec.tests, function (test) { + return test === name; + }) + }), 'name'); + content = content.replace( + matches[i], + matches[i].replace(SUREFIRE_TESTCASE_REGEX, '$1$2$3$4$5' + spec + '$7') + ); + } + // #6 + resultContent = resultContent.concat(content); + } else { + if (!reportFileExists) { + grunt.log.warn('The specified jUnit report [' + reportFile + '] does not exist'); + } else { + grunt.log.warn('No jUnit report has been specified'); + } + } + } + + }); + // #7 + grunt.file.write(outputFile, resultContent.concat(SUFFIX)); + } + + module.exports = jasmineJUnit; +})(); \ No newline at end of file diff --git a/tasks/karmaSonar.js b/tasks/karmaSonar.js new file mode 100644 index 0000000..9c4c7b7 --- /dev/null +++ b/tasks/karmaSonar.js @@ -0,0 +1,15 @@ +/* + * grunt-karma-sonar + * https://github.com/mdasberg/grunt-karma-sonar + * + * Copyright (c) 2015 Mischa Dasberg and contributors + * Licensed under the MIT license. + */ + +'use strict'; +module.exports = function (grunt) { + /** Sonar karma results. */ + grunt.registerMultiTask('karmaSonar', 'Grunt plugin for integrating karma reports with sonar', function () { + require('./sonar')(grunt).run(this); + }); +}; \ No newline at end of file diff --git a/tasks/karma_sonar.js b/tasks/karma_sonar.js deleted file mode 100644 index 5ecd775..0000000 --- a/tasks/karma_sonar.js +++ /dev/null @@ -1,209 +0,0 @@ -/* - * grunt-karma-sonar - * https://github.com/mdasberg/grunt-karma-sonar - * - * Copyright (c) 2013 Mischa Dasberg - * Licensed under the MIT license. - */ - -'use strict'; - -module.exports = function (grunt) { - var spawn = require("child_process").spawn, donePromise; - - grunt.registerMultiTask('karma_sonar', 'Grunt plugin for integrating karmma reports with sonar', function () { - donePromise = this.async(); - - var options = this.options({ - dynamicAnalysis: 'reuseReports', - language: 'js', - defaultOutputDir: '.tmp/sonar/' - }); - - var data = this.data; - - /** - * Updates the given lcov file content and returns it. - * @param source The source. - * @returns {*} - */ - function getUpdatedLcovFileContent(source) { - if (grunt.file.exists(source.coverageReport)) { - var content = grunt.file.read(source.coverageReport); - return content.replace(/SF:\./ig, 'SF:' + (source.prefix || '.')); - } else { - grunt.warn(source.coverageReport + " does not exist."); - return null; - } - } - - /** - * Merge the lcov files. - * @param sources The sources. - */ - function mergeLcovFiles(sources) { - var mergedAndUpdatedContent = ''; - sources.forEach(function (source) { - if (hasLcovFile(source)) { - mergedAndUpdatedContent = mergedAndUpdatedContent.concat(getUpdatedLcovFileContent(source) + '\n'); - } - }); - grunt.file.write(options.defaultOutputDir + 'coverage_report.lcov', mergedAndUpdatedContent); - } - - - /** - * Indicates has lcov files. - * @param sources The sources. - */ - function hasLcovFiles(sources) { - var result = false; - sources.forEach(function (source) { - if (hasLcovFile(source)) { - result = true; - } - }); - return result; - } - - /** - * Indicates has lcov file. - * @param source The source. - */ - function hasLcovFile(source) { - return source.coverageReport !== undefined; - } - - /** - * Updates the given junit file content and returns it. - * @param source The source. - * @returns {*} - */ - function getUpdatedJunitFileContent(source) { - if (grunt.file.exists(source.testReport)) { - var content = grunt.file.read(source.testReport); - content = content.replace(/\<\?xml.+\?\>/g, ''); - content = content.replace(/\/g, ''); - content = content.replace(/\<\/testsuites>/g, ''); - - return content; - } else { - grunt.warn(source.testReport + " does not exist."); - return null; - } - } - - /** - * Merge the junit files. - * @param sources The sources. - */ - function mergeJUnitFiles(sources) { - var mergedAndUpdatedContent = ''; - sources.forEach(function (source) { - if (hasJunitFile(source)) { - mergedAndUpdatedContent = mergedAndUpdatedContent.concat(getUpdatedJunitFileContent(source)); - } - }); - mergedAndUpdatedContent = mergedAndUpdatedContent.concat(''); - grunt.file.write(options.defaultOutputDir + 'TESTS-xunit.xml', mergedAndUpdatedContent); - } - - /** - * Indicates has junit files. - * @param sources The sources. - */ - function hasJunitFiles(sources) { - var result = false; - sources.forEach(function (source) { - if (hasJunitFile(source)) { - result = true; - } - }); - return result; - } - - /** - * Indicates has junit file. - * @param source The source. - */ - function hasJunitFile(source) { - return source.testReport !== undefined; - } - - /** - * Get the source paths from the sources. - * @param sources The sources. - * @returns {Array} - */ - function getSourcePaths(sources) { - var sourceLocations = []; - sources.forEach(function (source) { - sourceLocations.push(source.path); - }); - return sourceLocations; - } - - /** - * Get the sonar arguments. - * @param data The data. - * @param options The options. - * @returns {Array} - */ - function getSonarArguments(data, options) { - var args = []; - args.push('-Dsonar.sourceEncoding=' + 'UTF-8'); - args.push('-Dsonar.language=' + options.language); - args.push('-Dsonar.dynamicAnalysis=' + options.dynamicAnalysis); - args.push('-Dsonar.projectKey=' + data.project.key); - args.push('-Dsonar.projectName=' + data.project.name); - args.push('-Dsonar.projectVersion=' + data.project.version); - args.push('-Dsonar.sources=' + getSourcePaths(data.sources)); - if (hasLcovFiles(data.sources)) { - args.push('-Dsonar.javascript.lcov.reportPath=' + options.defaultOutputDir + 'coverage_report.lcov'); - } - if (hasJunitFiles(data.sources)) { - args.push('-Dsonar.javascript.jstest.reportsPath=' + options.defaultOutputDir); - } - args.push('-Dsonar.exclusions=' + data.exclusions); - - if (options.instance !== undefined) { - args.push('-Dsonar.host.url=' + options.instance.hostUrl); - args.push('-Dsonar.jdbc.url=' + options.instance.jdbcUrl); - if (options.instance.jdbcUsername !== undefined) { - args.push('-Dsonar.jdbc.username=' + options.instance.jdbcUsername); - } - if (options.instance.jdbcPassword !== undefined) { - args.push('-Dsonar.jdbc.password=' + options.instance.jdbcPassword); - } - if (options.instance.profile !== undefined) { - args.push('-Dsonar.profile=' + options.instance.profile); - } - args.push('-Dsonar.login=' + options.instance.login); - args.push('-Dsonar.password=' + options.instance.password); - } - return args; - } - - mergeLcovFiles(data.sources); - mergeJUnitFiles(data.sources); - - function exec() { - var child = grunt.util.spawn({ - cmd: 'sonar-runner', - args: getSonarArguments(data, options), - opts: { - stdio: 'inherit' - } - }, function (error, result, code) { - if (code !== 0) { - return grunt.warn('The following error occured while trying to upload to sonar: ' + error); - } else { - grunt.log.writeln('Uploaded information to sonar.'); - } - donePromise(); - }); - } - - exec(); - }); -}; diff --git a/tasks/sonar.js b/tasks/sonar.js new file mode 100644 index 0000000..7b27b94 --- /dev/null +++ b/tasks/sonar.js @@ -0,0 +1,186 @@ +'use strict'; + +module.exports = function (grunt) { + var glob = require("glob"), + fs = require('fs-extra'), + path = require('path'), + async = require('async'), + _ = require('lodash'), + jasmineJUnit = require('./jasmineJunit.js'), + coverage = require('./coverage.js'), + defaultOptions = { + dynamicAnalysis: 'reuseReports', + sourceEncoding: 'UTF-8', + language: 'js', + defaultOutputDir: '.tmp/sonar/', + scmDisabled: true, + instance: { + hostUrl: 'http://localhost:9000', + jdbcUrl: 'jdbc:h2:tcp://localhost:9093/sonar', + jdbcUsername: 'sonar', + jdbcPassword: 'sonar', + login: 'admin', + password: 'admin' + } + }; + + /** + * Copy files to the temp directory. + * @param g The glob. + */ + function copyFiles(g, defaultOutputDir) { + var files = glob.sync(g.src.toString(), {cwd: g.cwd, root: '/'}); + files.forEach(function (file) { + var destinationDirectory = defaultOutputDir; + var fileDirectory = path.dirname(file); + if (fileDirectory !== '.') { + destinationDirectory = destinationDirectory + path.sep + fileDirectory; + } + fs.mkdirpSync(destinationDirectory); + var source = path.resolve(g.cwd, file); + var destination = destinationDirectory + path.sep + path.basename(file); + fs.copySync(source, destination, {replace: true}); + }); + } + + /** + * Deep merge json objects. + * @param original The original object. + * @param override The override object. + * @return merged The merged object. + */ + function mergeJson(original, override) { + return _.merge(original, override, function (a, b) { + if (_.isArray(a)) { + return a.concat(b); + } + }); + + } + + return { + run: function (configuration) { + var data = configuration.data; + + if (typeof data.project === 'undefined') { + grunt.fail.fatal('No project information has been specified.'); + } + + if (typeof data.project.key === 'undefined') { + grunt.fail.fatal('Missing project key. Allowed characters are alphanumeric, \'-\', \'_\', \'.\' and \':\', with at least one non-digit.'); + } + + if (typeof data.project.name === 'undefined') { + grunt.fail.fatal('Missing project name. Please provide one.'); + } + + if (typeof data.paths === 'undefined' || data.paths.length === 0) { + grunt.fail.fatal('No paths provided. Please provide at least one.'); + } + + var sonarOptions = mergeJson(defaultOptions, configuration.options({})), + done = configuration.async(), + resultsDir = sonarOptions.defaultOutputDir + path.sep + 'results' + path.sep, + jUnitResultFile = resultsDir + 'TESTS-xunit.xml', + coverageResultFile = resultsDir + 'coverage_report.lcov'; + + async.series({ + // #1 + mergeJUnitReports: function (callback) { + grunt.verbose.writeln('Merging JUnit reports'); + jasmineJUnit.merge(data.paths, jUnitResultFile,callback); + callback(null, 200); + }, + // #2 + mergeCoverageReports: function (callback) { + grunt.verbose.writeln('Merging Coverage reports'); + coverage.merge(data.paths, coverageResultFile); + + callback(null, 200); + }, + //#3 + copy: function (callback) { + grunt.verbose.writeln('Copying files to working directory [' + sonarOptions.defaultOutputDir + ']'); + var sourceGlobs = [], + testGlobs = []; + + data.paths.forEach(function (p) { + var cwd = p.cwd ? p.cwd : '.'; + sourceGlobs.push({cwd: cwd, src: p.src + '/**/*'}); + testGlobs.push({cwd: cwd, src: p.test + '/**/*'}); + }); + + sourceGlobs.forEach(function (g) { + copyFiles(g, sonarOptions.defaultOutputDir); + }); + + testGlobs.forEach(function (g) { + copyFiles(g, sonarOptions.defaultOutputDir); + }); + callback(null, 200); + }, + //#4 + publish: function (callback) { + var opts = { + cmd: 'sonar-runner', + args: [ + '-Dsonar.sourceEncoding=' + sonarOptions.sourceEncoding, + '-Dsonar.language=' + sonarOptions.language, + '-Dsonar.dynamicAnalysis=' + sonarOptions.dynamicAnalysis, + '-Dsonar.projectKey=' + data.project.key, + '-Dsonar.projectName=' + data.project.name, + '-Dsonar.projectVersion=' + data.project.version, + '-Dsonar.projectBaseDir=' + sonarOptions.defaultOutputDir, + '-Dsonar.sources=' + 'src', + '-Dsonar.tests=' + 'test', + '-Dsonar.exclusions=' + data.exclusions, + '-Dsonar.javascript.jstestdriver.reportsPath=' + 'results', + '-Dsonar.javascript.lcov.reportPath=' + 'results' + path.sep + 'coverage_report.lcov', + '-Dsonar.scm.disabled=' + sonarOptions.scmDisabled, + '-Dsonar.host.url=' + sonarOptions.instance.hostUrl, + '-Dsonar.jdbc.url=' + sonarOptions.instance.jdbcUrl, + '-Dsonar.jdbc.username=' + sonarOptions.instance.jdbcUsername, + '-Dsonar.jdbc.password=' + sonarOptions.instance.jdbcPassword, + '-Dsonar.login=' + sonarOptions.instance.login, + '-Dsonar.password=' + sonarOptions.instance.password + ], + opts: { + stdio: 'inherit' + } + }; + + // Add custom properties + if (sonarOptions.runnerProperties) { + + Object.keys(sonarOptions.runnerProperties).forEach(function (prop) { + opts.args.push('-D' + prop + '=' + sonarOptions.runnerProperties[prop]); + }); + } + + + if (!sonarOptions.dryRun) { + grunt.util.spawn(opts, function (error, result, code) { + if (code !== 0) { + return grunt.warn('The following error occured while trying to upload to sonar: ' + error); + } else { + grunt.log.writeln('Uploaded information to sonar.'); + } + callback(null, 200); + }); + } else { + grunt.log.subhead('Dry-run'); + grunt.log.writeln('Sonar would have been triggered with the following sonar properties:', opts.args); + callback(null, 200); + } + + } + }, + function (err, results) { + if (err !== undefined) { + grunt.fail.fatal(err); + } + done(); + }); + } + }; +}; \ No newline at end of file diff --git a/test/expected/custom_options/TESTS-xunit.xml b/test/expected/custom_options/TESTS-xunit.xml deleted file mode 100644 index 2bdc90b..0000000 --- a/test/expected/custom_options/TESTS-xunit.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/test/expected/default_options/TESTS-xunit.xml b/test/expected/default_options/TESTS-xunit.xml deleted file mode 100644 index 4f42fcc..0000000 --- a/test/expected/default_options/TESTS-xunit.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/expected/sonar-one-path/TESTS-xunit.xml b/test/expected/sonar-one-path/TESTS-xunit.xml new file mode 100644 index 0000000..456da21 --- /dev/null +++ b/test/expected/sonar-one-path/TESTS-xunit.xml @@ -0,0 +1,19 @@ + + + + + + + + + Expected 'goodbye x app' to be 'hello x app'. + at /Users/mischa/workspace/karma-example/projectx/test/karma/xSpec.js:12 + + + + + + + \ No newline at end of file diff --git a/test/expected/sonar-one-path/coverage_report.lcov b/test/expected/sonar-one-path/coverage_report.lcov new file mode 100644 index 0000000..f9fe2ca --- /dev/null +++ b/test/expected/sonar-one-path/coverage_report.lcov @@ -0,0 +1,21 @@ +TN: +SF:./src/x.js +FN:1,App +FN:6,(anonymous_2) +FN:10,(anonymous_3) +FNF:3 +FNH:3 +FNDA:2,App +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +DA:1,1 +DA:2,2 +DA:6,2 +DA:7,1 +DA:10,2 +DA:11,1 +LF:6 +LH:6 +BRF:0 +BRH:0 +end_of_record diff --git a/test/expected/sonar-two-paths/TESTS-xunit.xml b/test/expected/sonar-two-paths/TESTS-xunit.xml new file mode 100644 index 0000000..b2de081 --- /dev/null +++ b/test/expected/sonar-two-paths/TESTS-xunit.xml @@ -0,0 +1,32 @@ + + + + + + + + + Expected 'goodbye x app' to be 'hello x app'. + at /Users/mischa/workspace/karma-example/projectx/test/karma/xSpec.js:12 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/expected/default_options/coverage_report.lcov b/test/expected/sonar-two-paths/coverage_report.lcov similarity index 51% rename from test/expected/default_options/coverage_report.lcov rename to test/expected/sonar-two-paths/coverage_report.lcov index 306a8d0..cd4ce23 100644 --- a/test/expected/default_options/coverage_report.lcov +++ b/test/expected/sonar-two-paths/coverage_report.lcov @@ -1,34 +1,42 @@ TN: -SF:sources/first/scripts/app-one.js +SF:./src/x.js FN:1,App FN:6,(anonymous_2) -FNF:2 -FNH:2 -FNDA:1,App +FN:10,(anonymous_3) +FNF:3 +FNH:3 +FNDA:2,App FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) DA:1,1 -DA:2,1 -DA:6,1 +DA:2,2 +DA:6,2 DA:7,1 -LF:4 -LH:4 +DA:10,2 +DA:11,1 +LF:6 +LH:6 BRF:0 BRH:0 end_of_record TN: -SF:sources/second/scripts/app-two.js +SF:./src/y.js FN:1,App FN:6,(anonymous_2) -FNF:2 +FN:10,(anonymous_3) +FNF:3 FNH:2 FNDA:1,App FNDA:1,(anonymous_2) +FNDA:0,(anonymous_3) DA:1,1 DA:2,1 DA:6,1 DA:7,1 -LF:4 -LH:4 +DA:10,1 +DA:11,0 +LF:6 +LH:5 BRF:0 BRH:0 end_of_record diff --git a/test/karmaSonarSpec.js b/test/karmaSonarSpec.js new file mode 100644 index 0000000..6dc37e1 --- /dev/null +++ b/test/karmaSonarSpec.js @@ -0,0 +1,180 @@ +'use script'; + + +/** + * Tests for the Karma Sonar grunt plugin. + */ +describe('KarmaSonar', function () { + var gruntMock = require('gruntmock'), + karmaSonar = require('./../tasks/karmaSonar.js'), + fs = require('fs'), + fsExtra = require('fs-extra'), + path = require('path'), + bufferEqual = require('buffer-equal'); + + /** + * Indicates if the file content matches. + * @param actual The actual. + * @param expected The expected. + * @returns {*} + */ + function fileContentMatches(actual, expected) { + return bufferEqual(fs.readFileSync(actual),fs.readFileSync(expected)); + } + + const DEFAULT_OPTIONS = { + defaultOutputDir: '.tmp/sonar', + instance: { + jdbcUrl: 'jdbc:h2:tcp://localhost:9092/sonar' + }, + dryRun: true, + runnerProperties: { + 'sonar.links.homepage': 'https://github.com/mdasberg/grunt-karma-sonar', + 'sonar.branch': 'master' + } + }; + + it('should fail when no project information has been provided in the configuration', function (done) { + var mock = gruntMock.create({ + target: 'all', options: DEFAULT_OPTIONS, data: {} + } + ); + mock.invoke(karmaSonar, function (err) { + expect(mock.logError[0]).toBe('No project information has been specified.'); + done(); + }); + }); + + it('should fail when no project key has been provided in the configuration', function (done) { + var mock = gruntMock.create({ + target: 'all', options: DEFAULT_OPTIONS, data: { + project: {} + } + } + ); + mock.invoke(karmaSonar, function (err) { + expect(mock.logError[0]).toBe('Missing project key. Allowed characters are alphanumeric, \'-\', \'_\', \'.\' and \':\', with at least one non-digit.'); + done(); + }); + }); + + it('should fail when no project key has been provided in the configuration', function (done) { + var mock = gruntMock.create({ + target: 'all', options: DEFAULT_OPTIONS, data: { + project: { + key: 'key' + } + } + } + ); + mock.invoke(karmaSonar, function (err) { + expect(mock.logError[0]).toBe('Missing project name. Please provide one.'); + done(); + }); + }); + + it('should fail when no paths have been provided in the configuration', function (done) { + var mock = gruntMock.create({ + target: 'all', options: DEFAULT_OPTIONS, data: { + project: { + key: 'key', + name: 'name' + } + } + } + ); + mock.invoke(karmaSonar, function (err) { + expect(mock.logError.length).toBe(1); + expect(mock.logError[0]).toBe('No paths provided. Please provide at least one.'); + done(); + }); + }); + + it('should update the data', function (done) { + var opts = DEFAULT_OPTIONS + opts.defaultOutputDir = '.tmp/sonar-one-path'; + var mock = gruntMock.create({ + target: 'all', options: DEFAULT_OPTIONS, data: { + project: { + key: 'key', + name: 'name' + }, + paths: [ + { + cwd: 'data/projectx', + src: 'src', + test: 'test', + reports: { + unit: 'results/karma/results.xml', + coverage: 'results/karma/coverage/**/lcov.info' + } + } + ] + } + } + ); + mock.invoke(karmaSonar, function (err) { + expect(mock.logError.length).toBe(0); + expect(mock.logOk.length).toBe(5); + expect(mock.logOk[0]).toBe('Merging JUnit reports'); + expect(mock.logOk[1]).toBe('Merging Coverage reports'); + expect(mock.logOk[2]).toBe('Copying files to working directory ['+opts.defaultOutputDir+']'); + expect(mock.logOk[3]).toBe('Dry-run'); + expect(mock.logOk[4]).toBe('Sonar would have been triggered with the following sonar properties:'); + expect(fsExtra.existsSync(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'TESTS-xunit.xml')).toBeTruthy(); + expect(fsExtra.existsSync(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'coverage_report.lcov')).toBeTruthy(); + expect(fileContentMatches(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'coverage_report.lcov','test/expected/sonar-one-path' + path.sep + 'coverage_report.lcov')).toBeTruthy(); + expect(fileContentMatches(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'TESTS-xunit.xml','test/expected/sonar-one-path' + path.sep + 'TESTS-xunit.xml')).toBeTruthy(); + done(); + }); + }); + + it('should merge and update data from two paths', function (done) { + var opts = DEFAULT_OPTIONS + opts.defaultOutputDir = '.tmp/sonar-two-paths'; + var mock = gruntMock.create({ + target: 'all', options: DEFAULT_OPTIONS, data: { + project: { + key: 'key', + name: 'name' + }, + paths: [ + { + cwd: 'data/projectx', + src: 'src', + test: 'test', + reports: { + unit: 'results/karma/results.xml', + coverage: 'results/karma/coverage/**/lcov.info' + } + }, + { + cwd: 'data/projecty', + src: 'src', + test: 'test', + reports: { + unit: 'results/karma/results.xml', + coverage: 'results/karma/coverage/**/lcov.info' + } + } + ] + } + } + ); + mock.invoke(karmaSonar, function (err) { + expect(mock.logError.length).toBe(0); + expect(mock.logOk.length).toBe(5); + expect(mock.logOk[0]).toBe('Merging JUnit reports'); + expect(mock.logOk[1]).toBe('Merging Coverage reports'); + expect(mock.logOk[2]).toBe('Copying files to working directory ['+opts.defaultOutputDir+ ']'); + expect(mock.logOk[3]).toBe('Dry-run'); + expect(mock.logOk[4]).toBe('Sonar would have been triggered with the following sonar properties:'); + expect(fsExtra.existsSync(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'TESTS-xunit.xml')).toBeTruthy(); + expect(fsExtra.existsSync(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'coverage_report.lcov')).toBeTruthy(); + expect(fileContentMatches(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'coverage_report.lcov','test/expected/sonar-two-paths' + path.sep + 'coverage_report.lcov')).toBeTruthy(); + expect(fileContentMatches(opts.defaultOutputDir + path.sep + 'results' + path.sep + 'TESTS-xunit.xml','test/expected/sonar-two-paths' + path.sep + 'TESTS-xunit.xml')).toBeTruthy(); + done(); + }); + }); +}); + diff --git a/test/karma_sonar_test.js b/test/karma_sonar_test.js index cff26ed..25ced9b 100644 --- a/test/karma_sonar_test.js +++ b/test/karma_sonar_test.js @@ -27,15 +27,15 @@ exports.karma_sonar = { // setup here if necessary done(); }, - default_options: function (test) { - test.expect(1); - - var actual = grunt.file.read('.tmp/sonar/coverage_report.lcov'); - var expected = grunt.file.read('test/expected/default_options/coverage_report.lcov'); - test.equal(actual, expected, 'should describe what the default behavior is.'); - - test.done(); - }, + //default_options: function (test) { + // test.expect(1); + // + // var actual = grunt.file.read('.tmp/sonar/coverage_report.lcov'); + // var expected = grunt.file.read('test/expected/default_options/coverage_report.lcov'); + // test.equal(actual, expected, 'should describe what the default behavior is.'); + // + // test.done(); + //}, custom_options: function (test) { test.expect(1);