Giter Club home page Giter Club logo

jasmine-reporters's Introduction

This branch is for Jasmine 2.x. Switch to the 1.x branch.

Jasmine Reporters

Jasmine Reporters is a collection of javascript jasmine.Reporter classes that can be used with the JasmineBDD testing framework.

Included reporters:

  • JUnitXmlReporter - Report test results to a file in JUnit XML Report format.
  • NUnitXmlReporter - Report test results to a file in NUnit XML Report format.
  • TapReporter - Test Anything Protocol, report tests results to console.
  • TeamCityReporter - Basic reporter that outputs spec results to for the Teamcity build system.
  • TerminalReporter - Logs to a terminal (including colors) with variable verbosity.

PhantomJS

Should work with all modern versions of Phantom JS, and has been tested with PhantomJS 1.4.6 through 1.9.6 on Mac OS X. If you find issues with a particular version, please consider creating a pull request.

Node.js

The reporters also work in Node.js, and most can be used in combination with jasmine-node. Make sure to use the correct combination of jasmine-reporters and jasmine-node, as both projects have different versions / branches for Jasmine1.x vs Jasmine2.x support.

Basic Usage

When used for in-browser tests, the reporters are registered on a jasmineReporters object in the global scope (i.e. window.jasmineReporters).

var junitReporter = new jasmineReporters.JUnitXmlReporter({
    savePath: '..',
    consolidateAll: false
});
jasmine.getEnv().addReporter(junitReporter);

PhantomJS

In order to write files to the local filesystem for in-browser tests, the reporters will attempt to use PhantomJS to create the files. A special method __phantom_writeFile is injected by the included phantomjs.runner.sh script.

It is strongly recommended to use the provided script to run your test suite using PhantomJS. If you want to use your own PhantomJS runner, you will need to inject a __phantom_writeFile method, and also take care to correctly determine when all results have been reported.

You can use the included PhantomJS test runner to run any of the included examples.

bin/phantomjs.runner.sh test/tap_reporter.html
bin/phantomjs.runner.sh test/junit_xml_reporter.html

NodeJS

In Node.js, jasmine-reporters exports an object with all the reporters which you can use however you like.

var reporters = require('jasmine-reporters');
var junitReporter = new reporters.JUnitXmlReporter({
    savePath: __dirname,
    consolidateAll: false
});

More examples

An example for each reporter is available in the test directory.

jasmine-reporters is built for Jasmine 2.x. If you are still using Jasmine 1.x, please use the correct tag / branch / npm version:

  • bower: bower install jasmine-reporters#^1.0.0
  • Node.js: npm install jasmine-reporters@^1.0.0
  • git submodule: git submodule add -b jasmine1.x [email protected]:larrymyers/jasmine-reporters.git jasmine-reporters
  • or use any of the 1.* tags

Migrating from [email protected]

  • reporters are no longer registered on the global jasmine object
    • 1.x: new jasmine.JUnitXmlReporter( /* ... */ );
    • 2.x: new jasmineReporters.JUnitXmlReporter( /* ... */ );
  • configurable reporters no longer use positional arguments
    • 1.x: new jasmine.JUnitXmlReporter('testresults', true, true, 'junit-', true);
    • 2.x: new jasmineReporters.JUnitXmlReporter({savePath:'testresults', filePrefix: 'junit-', consolidateAll:true});

Protractor

As of Protractor 1.6.0, protractor supports Jasmine 2 by specifying framework: "jasmine2" in your protractor.conf file.

First, install a Jasmine 2.x-compatible of jasmine-reporters:

npm install --save-dev jasmine-reporters@^2.0.0

Then set everything up inside your protractor.conf:

framework: "jasmine2",
onPrepare: function() {
    var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: true,
        filePrefix: 'xmloutput',
        savePath: 'testresults'
    }));
}

jasmine-reporters's People

Contributors

putermancer avatar larrymyers avatar mtscout6 avatar voltrevo avatar sheile avatar theraven avatar eeroan avatar colinbate avatar decoy31 avatar millermedeiros avatar alanning avatar ahus1 avatar shustariov-andrey avatar cburgmer avatar jayharris avatar zazoomauro avatar mbest avatar mgol avatar ondras avatar zubairov avatar founddrama avatar uzikilon avatar cscleison avatar leeight avatar

Watchers

James Cloos avatar Karthik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.