jshint-reporter-bamboo

0.1.4 • Public • Published

jshint-reporter-bamboo

view on npm npm module downloads per month Dependency status Coverage

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 on report.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

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

Type ID Summary
Version: 0.1.4 - released 2014-10-13
Non-functional MSJSHRB-8 Package: Remove all gulp tasks except 'test' and update readme docs
Bug MSJSHRB-7 Package: Fix mocha error reporting
Version: 0.1.3 - released 2014-08-30
Non-functional MSJSHRB-6 Package: Migrate to new Cellarise Package Manager.
Version: 0.1.2 - released 2014-08-23
Feature MSJSHRB-5 Package: Add cucumber report output format.
Version: 0.1.1 - released 2014-08-21
Non-functional MSJSHRB-4 Package: Update dependencies.
Version: 0.1.0 - released 2014-08-17
Feature MSJSHRB-2 Package: Develop bamboo reporter for JSHint.

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.

Readme

Keywords

none

Package Sidebar

Install

npm i jshint-reporter-bamboo

Weekly Downloads

3

Version

0.1.4

License

MIT License (MIT)

Last publish

Collaborators

  • cellarise