Skip to content

Commit

Permalink
Major refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mdasberg committed Apr 2, 2015
1 parent ac008e9 commit 3b2ffbb
Show file tree
Hide file tree
Showing 51 changed files with 2,227 additions and 463 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<a name="0.1.6"></a>
# 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
158 changes: 72 additions & 86 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

};
}
;
Loading

0 comments on commit 3b2ffbb

Please sign in to comment.