1 | /*
|
2 | * grunt-karma-sonar
|
3 | * https://github.com/mdasberg/grunt-karma-sonar
|
4 | *
|
5 | * Copyright (c) 2013 Mischa Dasberg
|
6 | * Licensed under the MIT license.
|
7 | */
|
8 | (function() {
|
9 | ;
|
10 |
|
11 | module.exports = function (grunt) {
|
12 |
|
13 | // Project configuration.
|
14 | grunt.initConfig({
|
15 | jshint: {
|
16 | all: [
|
17 | 'Gruntfile.js',
|
18 | 'tasks/*.js'
|
19 | ],
|
20 | options: {
|
21 | jshintrc: '.jshintrc'
|
22 | }
|
23 | },
|
24 | karmaSonar: {
|
25 | options: {
|
26 | defaultOutputDir: '.tmp/sonar2',
|
27 | instance: {
|
28 | jdbcUrl: 'jdbc:h2:tcp://localhost:9092/sonar'
|
29 | },
|
30 | dryRun: true,
|
31 | runnerProperties: {
|
32 | 'sonar.links.homepage': 'https://github.com/mdasberg/grunt-karma-sonar',
|
33 | 'sonar.branch': 'master'
|
34 | }
|
35 | },
|
36 | all: {
|
37 | project: {
|
38 | key: 'grunt-karma-sonar',
|
39 | name: 'Grunt-karma-sonar plugin',
|
40 | version: '0.2.10'
|
41 | },
|
42 | paths: [
|
43 | {
|
44 | cwd: 'node_modules/angular-test-setup',
|
45 | src: 'src',
|
46 | test: 'test',
|
47 | reports: {
|
48 | unit: 'results/karma/TESTS*.xml',
|
49 | itUnit: {src:'results/protractor/cucumber/chrome/*.xml', framework: 'cucumber'},
|
50 | coverage: 'results/karma/coverage/**/lcov.info',
|
51 | itCoverage: 'results/protractor-coverage/**/lcov.info'
|
52 | }
|
53 | },
|
54 | {
|
55 | cwd: 'node_modules/angular-test-setup',
|
56 | src: 'src',
|
57 | test: 'test',
|
58 | reports: {
|
59 | itUnit: {src:'results/protractor/jasmine2/chrome/*.xml', framework: 'jasmine2'}
|
60 | }
|
61 | },
|
62 | {
|
63 | cwd: 'data/projectx',
|
64 | src: 'src',
|
65 | test: 'test',
|
66 | reports: {
|
67 | unit: 'results/karma/results.xml',
|
68 | coverage: 'results/karma/coverage/**/lcov.info'
|
69 | }
|
70 | },
|
71 | {
|
72 | cwd: 'data/karma02x',
|
73 | src: 'src',
|
74 | test: 'test',
|
75 | reports: {
|
76 | unit: 'results/karma/results.xml',
|
77 | coverage: 'results/unit/coverage/**/lcov.info'
|
78 | }
|
79 | }
|
80 | ]
|
81 | }
|
82 | },
|
83 |
|
84 | // Before generating any new files, remove any previously-created files.
|
85 | clean: {
|
86 | tests: ['.tmp'],
|
87 | install: ['lib']
|
88 | },
|
89 |
|
90 | shell: {
|
91 | target: {
|
92 | command: 'node_modules/jasmine-node/bin/jasmine-node test/*Spec.js'
|
93 | }
|
94 | }
|
95 | }
|
96 | );
|
97 |
|
98 | // Actually load this plugin's task(s).
|
99 | grunt.loadTasks('tasks');
|
100 |
|
101 | // These plugins provide necessary tasks.
|
102 | grunt.loadNpmTasks('grunt-contrib-jshint');
|
103 | grunt.loadNpmTasks('grunt-contrib-clean');
|
104 | grunt.loadNpmTasks('grunt-shell');
|
105 |
|
106 | // Whenever the "test" task is run, first clean the "tmp" dir, then run this
|
107 | // plugin's task(s), then test the result.
|
108 | grunt.registerTask('test', ['clean', 'shell']);
|
109 |
|
110 | // By default, lint and run all tests.
|
111 | grunt.registerTask('default', ['jshint', 'test']);
|
112 |
|
113 | };
|
114 | })();
|