Skip to content

Feature/junit xml reporter #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ module.exports = function (grunt) {
spec: {
colors: true
},
junitXml: {
savePath: "reports",
consolidateAll: true
}
// Uncomment line below to activate teamcity reporter
//teamcity: true
}
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ Jasmine specific configuration. Use empty object,

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

The `reporters` property allows the one of the following properties:
The `reporters` property allows the following properties:

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

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

Expand All @@ -100,6 +102,21 @@ Example of using `teamcity` reporter:
}
```

Example of using `junitXml` reporter:

```js
{
spec_dir: 'spec',
spec_files: ['**/*[sS]pec/.js'],
helpers: [],
reporters: {
junitXml: {
savePath: "reports",
consolidateAll: true
}
}
```

#### options.coverage

Type: `object`
Expand Down
8 changes: 6 additions & 2 deletions tasks/jasmine-node-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,16 @@ module.exports = function jasmineNodeTask(grunt) {
reporter.name = 'TeamCity Reporter';
jasmine.addReporter(reporter);
}
else {
else if (ropts.spec) {
reporter = new SpecReporter(ropts.spec);
reporter.name = 'Spec Reporter';
jasmine.addReporter(reporter);
}

if (ropts.junitXml){
reporter = new reporters.JUnitXmlReporter(ropts.junitXml);
jasmine.addReporter(reporter);
}
};

var runner = function runner(opts) {
Expand Down Expand Up @@ -277,7 +282,6 @@ module.exports = function jasmineNodeTask(grunt) {
jasmine: {
spec_dir: 'spec',
reporters: {
spec: {}
}
},

Expand Down