jshint-reporter-bamboo
v0.1.4
Published
A reporter for gulp-jshint which produces a report compatible with Atlassian Bamboo Mocha Test Parser.
Downloads
75
Readme
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
[email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT*", [email protected] - "BSD", [email protected] - "MIT", [email protected] - ["MIT"], [email protected] - "MIT", [email protected] - "ISC", [email protected] - "MIT", [email protected] - "MIT License (MIT)", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - , [email protected] - "MIT", [email protected] - "MIT*", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - "MIT", [email protected] - ["MIT"], [email protected] - ["MIT"], documented by npm-licenses.