npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cypress-junit-reporter

v1.3.1

Published

A JUnit reporter for mocha.

Downloads

193,304

Readme

JUnit Reporter for Cypress

npm

Produces JUnit-style XML test results.

Installation

$ npm install cypress-junit-reporter --save-dev

or as a global module

$ npm install -g cypress-junit-reporter

Usage

Run mocha with cypress-junit-reporter:

$ mocha test --reporter cypress-junit-reporter

This will output a results file at ./test-results.xml. You may optionally declare an alternate location for results XML file by setting the environment variable MOCHA_FILE or specifying mochaFile in reporterOptions:

$ MOCHA_FILE=./path_to_your/file.xml mocha test --reporter cypress-junit-reporter

or

$ mocha test --reporter cypress-junit-reporter --reporter-options mochaFile=./path_to_your/file.xml

or

var mocha = new Mocha({
    reporter: 'cypress-junit-reporter',
    reporterOptions: {
        mochaFile: './path_to_your/file.xml'
    }
});

Append properties to testsuite

You can also add properties to the report under testsuite. This is useful if you want your CI environment to add extra build props to the report for analytics purposes

<testsuites>
  <testsuite>
    <properties>
      <property name="BUILD_ID" value="4291"/>
    </properties>
    <testcase/>
    <testcase/>
    <testcase/>
  </testsuite>
</testsuites>

To do so pass them in via env variable:

PROPERTIES=BUILD_ID:4291 mocha test --reporter cypress-junit-reporter

or

var mocha = new Mocha({
    reporter: 'cypress-junit-reporter',
    reporterOptions: {
        properties: {
            BUILD_ID: 4291
        }
    }
})

Results Report

Results XML filename can contain [hash], e.g. ./path_to_your/test-results.[hash].xml. [hash] is replaced by MD5 hash of test results XML. This enables support of parallel execution of multiple cypress-junit-reporter's writing test results in separate files.

In order to display full suite title (including parents) just specify testsuitesTitle option

var mocha = new Mocha({
    reporter: 'cypress-junit-reporter',
    reporterOptions: {
        testsuitesTitle: true,
        suiteTitleSeparatedBy: '.' // suites separator, default is space (' ')
    }
});

If you want to switch classname and name of the generated testCase XML entries, you can use the testCaseSwitchClassnameAndName reporter option.

var mocha = new Mocha({
    reporter: 'cypress-junit-reporter',
    reporterOptions: {
        testCaseSwitchClassnameAndName: true
    }
});

Here is an example of the XML output when using the testCaseSwitchClassnameAndName option:

| value | XML output | |----------------------------------|--------| | true | <testcase name="should behave like so" classname="Super Suite should behave like so"> | | false (default) | <testcase name="Super Suite should behave like so" classname="should behave like so"> |

You can also configure the testsuites.name attribute by setting reporterOptions.testsuitesTitle and the root suite's name attribute by setting reporterOptions.rootSuiteTitle.

Full configuration options

| Parameter | Effect | | --------- | ------ | | mochaFile | configures the file to write reports to | | includePending | if set to a truthy value pending tests will be included in the report | | properties | a hash of additional properties to add to each test suite | | toConsole | if set to a truthy value the produced XML will be logged to the console | | useFullSuiteTitle | if set to a truthy value nested suites' titles will show the suite lineage | | suiteTitleSeparedBy | the character to use to separate nested suite titles. (defaults to ' ') | | testCaseSwitchClassnameAndName | set to a truthy value to switch name and classname values | | rootSuiteTitle | the name for the root suite. (defaults to 'Root Suite') | | testsuitesTitle | the name for the testsuites tag (defaults to 'Mocha Tests') |