GithubHelp home page GithubHelp logo

nashjain / jasmine2-junit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sandermak/jasmine2-junit

0.0 2.0 0.0 145 KB

A reporter for Jasmine 2.0 that outputs JUnit XML to a file. Run it with PhantomJS.

License: Other

JavaScript 95.74% CSS 4.26%

jasmine2-junit's Introduction

jasmine2-junit

By default, Jasmine 2.0 only provides a ConsoleReporter and HtmlReporter. Neither are suitable for reporting in a CI build. This project adds a JUnitXmlReporter which outputs JUnit compliant testreports. The reporter currently only works when running specs with PhantomJS.

Usage

In order to setup jasmine2-junit, you need to add the following scripts to your spec runner html file:

<!-- Include Jasmine 2.0's assets -->
<link href="lib/jasmine.css" rel="stylesheet" type="text/css">
<script src="lib/jasmine.js"></script>
<script src="lib/jasmine-html.js"></script>

<!-- The JUnit reporter should go before the boot script -->
<script src="../src/jasmine2-junit.js"></script>
<!-- This boot.js is a modified version of Jasmine's default boot.js! -->
<script src="../src/boot.js"></script>

<!-- Include your spec files here -->>
<script src="spec.js"></script>

Note that the boot.js file is a modified version of the file with same name that is provided by the default Jasmine 2.0 distribution. The only modification is that the JUnitXmlReporter is added as reporter. Currently, it seems impossible to add a reporter while still using the stock boot.js.

After you setup your spec html, you can use the jasmine2-runner.js script with PhantomJS to execute your spec:

phantomjs jasmine2-runner.js yourspec.html

After running this script, JUnit XML files with testresults are written to the current directory. They all start with a TEST- prefix and end with .xml.

Example

See the example for a working setup of jasmine2-junit with Jasmine 2.0. Install the PhantomJS node package:

npm install -g phantomjs

in the example directory, run phantomjs ../src/jasmine2-runner.js specrunner.html. JUnit XML output files are written with a TEST-* prefix for each top-level describe() (suite) in the testsuites that are run by specrunner.html.

Acknowledgments

The code and setup for this project are heavily based on the JUnitXmlReporter at https://github.com/larrymyers/jasmine-reporters which only works for Jasmine 1.x.

jasmine2-junit's People

Watchers

Naresh Jain avatar James Cloos 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.