Skip to content

Commit 0782ac2

Browse files
authored
Merge pull request #65 from jmpresso/feature/junitXmlReporter
Feature/junit xml reporter
2 parents bffd53a + a169f13 commit 0782ac2

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Gruntfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ module.exports = function (grunt) {
4141
spec: {
4242
colors: true
4343
},
44+
junitXml: {
45+
savePath: "reports",
46+
consolidateAll: true
47+
}
4448
// Uncomment line below to activate teamcity reporter
4549
//teamcity: true
4650
}

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ Jasmine specific configuration. Use empty object,
8080

8181
See the [jasmine docs](http://jasmine.github.io/2.4/node.html#section-Configuration) for more information on the supported configuration.
8282

83-
The `reporters` property allows the one of the following properties:
83+
The `reporters` property allows the following properties:
8484

8585
* `spec`: used to configure the [Jasmine spec reporter](https://github.com/bcaudan/jasmine-spec-reporter).
8686
* `teamcity` set it to `true` in order to use [Jasmine Reporters - TeamCityReporter](https://github.com/larrymyers/jasmine-reporters).
87+
* `junitXml` set it to a object to use [Jasmine Reporters - JUnitXmlReporter](https://github.com/larrymyers/jasmine-reporters). See the jasmine-reporters
88+
documentation for additional configuration options.
8789

8890
If `teamcity` reporter is set `spec` reporter will be disabled and `teamcity` reporter will be added to the coverage reporters as well.
8991

@@ -100,6 +102,21 @@ Example of using `teamcity` reporter:
100102
}
101103
```
102104

105+
Example of using `junitXml` reporter:
106+
107+
```js
108+
{
109+
spec_dir: 'spec',
110+
spec_files: ['**/*[sS]pec/.js'],
111+
helpers: [],
112+
reporters: {
113+
junitXml: {
114+
savePath: "reports",
115+
consolidateAll: true
116+
}
117+
}
118+
```
119+
103120
#### options.coverage
104121
105122
Type: `object`

tasks/jasmine-node-task.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,16 @@ module.exports = function jasmineNodeTask(grunt) {
180180
reporter.name = 'TeamCity Reporter';
181181
jasmine.addReporter(reporter);
182182
}
183-
else {
183+
else if (ropts.spec) {
184184
reporter = new SpecReporter(ropts.spec);
185185
reporter.name = 'Spec Reporter';
186186
jasmine.addReporter(reporter);
187187
}
188+
189+
if (ropts.junitXml){
190+
reporter = new reporters.JUnitXmlReporter(ropts.junitXml);
191+
jasmine.addReporter(reporter);
192+
}
188193
};
189194

190195
var runner = function runner(opts) {
@@ -277,7 +282,6 @@ module.exports = function jasmineNodeTask(grunt) {
277282
jasmine: {
278283
spec_dir: 'spec',
279284
reporters: {
280-
spec: {}
281285
}
282286
},
283287

0 commit comments

Comments
 (0)