jshint-reporter-bamboo
A reporter for gulp-jshint which produces a report compatible with Atlassian Bamboo Mocha Test Parser.
##Usage
This reporter for gulp-jshint requires an object to store the results of each file analysed by jshint.
As a gulp task
Require this package and use as part of your gulp-jshint task. Pass an empty 'report' object. The report results will be available on report.results
.
var JshintReporterBamboo = require('jshint-reporter-bamboo');
var jshint = require('gulp-jshint');
var report = {};
gulp.src('./lib')
.pipe(jshint())
.pipe(new JshintReporterBamboo(report));
.on('end', function() {
fs.writeFileSync('report.json', JSON.stringify(report.results, null, 2), 'utf-8');
done();
});
API
#jshint-reporter-bamboo A reporter for gulp-jshint which produces a report compatible with Atlassian Bamboo Mocha Test Parser.
Params
- reportJSON
Object
- object to receive the results of the test. The report results will be available onreport.results
. - opts
Object
- Task configuration options- [report='mocha']
string
- The test report format to use. Select from 'mocha' or 'cucumber'. - [suiteName='JSHint']
string
- The test suite name - [suiteDesc='']
string
- The test suite description
- [report='mocha']
Type: name
Returns: readable-stream/transform
Example
Given the Javascript file:
for (i=0; i < 10; i = i + 1) {
ctr = ctr + i;
}
When you pass the file to a new JshintReporterBamboo()
using an empty 'report' object. The report results will be available on report.results
.
var JshintReporterBamboo = require('jshint-reporter-bamboo');
var jshint = require('gulp-jshint');
var report = {};
gulp.src('./lib')
.pipe(jshint())
.pipe(new JshintReporterBamboo(report));
.on('end', function() {
fs.writeFileSync('report.json', JSON.stringify(report.results, null, 2), 'utf-8');
done();
});
Then you'll get a jshint mocha formatted report:
{
"stats": {
"start": "2014-08-22T06:04:30.645Z",
"end": "2014-08-22T06:04:30.707Z",
"suites": null,
"tests": null,
"duration": 62,
"passes": null
},
"failures": [],
"passes": [
{
"title": " index.js",
"fullTitle": " \\jshint-reporter-bamboo\\lib\\index.js",
"duration": 62
}
],
"skipped": []
}
When you pass the file to a new JshintReporterBamboo()
using options report='cucumber'.
var JshintReporterBamboo = require('jshint-reporter-bamboo');
var jshint = require('gulp-jshint');
var report = {};
gulp.src('./lib')
.pipe(jshint())
.pipe(new JshintReporterBamboo(report, {report:'cucumber'}));
.on('end', function() {
fs.writeFileSync('report.json', JSON.stringify(report.results, null, 2), 'utf-8');
done();
});
Then you'll get a jshint cucumber formatted report:
[
{
"id": "JSHINT-code-analysis-feature",
"uri": "features/JSHINT-code-analysis.feature",
"keyword": "Feature",
"name": "JSHINT code analysis",
"line": 1,
"description": "As a developer\nI want to ensure JSHINT code analysis standards are met\nSo that my code is conformant with technical standards designed to ensure consistency and readability",
"elements": [
{
"id": "index.js",
"keyword": "Scenario",
"name": "index.js",
"line": 3,
"description": "\\jshint-reporter-bamboo\\lib\\index.js",
"type": "scenario",
"steps": [
{
"result": {
"duration": 0,
"status": "passed"
},
"name": "a Javascript file",
"keyword": "Given ",
"line": 4
},
{
"result": {
"duration": 0,
"status": "passed"
},
"name": "analysed using JSHint and the repositories default JSHint configuration file",
"keyword": "When ",
"line": 5
},
{
"result": {
"duration": 0,
"status": "passed"
},
"name": "the file should meet the defined coding standards",
"keyword": "Then ",
"line": 6
}
]
}
]
}
]
documented by jsdoc-to-markdown.
#Changelog
License
MIT License (MIT). All rights not explicitly granted in the license are reserved.
Copyright (c) 2014 John Barry
Dependencies
ansi-regex@0.2.1 - "MIT", ansi-styles@1.1.0 - "MIT", chalk@0.5.1 - "MIT", clone-stats@0.0.1 - "MIT", core-util-is@1.0.1 - "MIT", dateformat@1.0.8-1.2.3 - "MIT*", duplexer2@0.0.2 - "BSD", escape-string-regexp@1.0.1 - "MIT", gulp-util@3.0.0 - ["MIT"], has-ansi@0.1.0 - "MIT", inherits@2.0.1 - "ISC", isarray@0.0.1 - "MIT", jshint-reporter-bamboo@0.0.0 - "MIT License (MIT)", lodash._escapehtmlchar@2.4.1 - "MIT", lodash._escapestringchar@2.4.1 - "MIT", lodash._htmlescapes@2.4.1 - "MIT", lodash._isnative@2.4.1 - "MIT", lodash._objecttypes@2.4.1 - "MIT", lodash._reinterpolate@2.4.1 - "MIT", lodash._reunescapedhtml@2.4.1 - "MIT", lodash._shimkeys@2.4.1 - "MIT", lodash.defaults@2.4.1 - "MIT", lodash.escape@2.4.1 - "MIT", lodash.isobject@2.4.1 - "MIT", lodash.keys@2.4.1 - "MIT", lodash.template@2.4.1 - "MIT", lodash.templatesettings@2.4.1 - "MIT", lodash.values@2.4.1 - "MIT", lodash@2.4.1 - "MIT", map-stream@0.1.0 - , minimist@0.2.0 - "MIT", multipipe@0.1.1 - "MIT*", readable-stream@1.0.31 - "MIT", readable-stream@1.1.13 - "MIT", string_decoder@0.10.31 - "MIT", strip-ansi@0.3.0 - "MIT", supports-color@0.2.0 - "MIT", through2@0.5.1 - "MIT", vinyl@0.2.3 - ["MIT"], xtend@3.0.0 - ["MIT"], documented by npm-licenses.