Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mocha-junit-reporter

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-junit-reporter

A JUnit reporter for mocha.

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-1.46%
Maintainers
2
Weekly downloads
 
Created

What is mocha-junit-reporter?

The mocha-junit-reporter npm package is designed to generate JUnit-style XML test results from Mocha tests, which is particularly useful for integrating Mocha tests with continuous integration systems like Jenkins, CircleCI, or GitLab CI that can consume JUnit XML reports. This reporter is highly configurable and can be used both in command line and programmatically in Node.js.

What are mocha-junit-reporter's main functionalities?

JUnit XML Report Generation

This feature allows the generation of JUnit XML reports from Mocha tests. The code sample demonstrates how to set up Mocha with the mocha-junit-reporter to output test results in JUnit XML format to a specified file.

const Mocha = require('mocha');
const mocha = new Mocha({
  reporter: 'mocha-junit-reporter',
  reporterOptions: {
    mochaFile: './test-results/results.xml'
  }
});
mocha.addFile('./test/some-test.js');
mocha.run();

Configuration via Environment Variables

This feature supports configuring the reporter through environment variables. The code sample shows how to configure the output file and additional properties using environment variables before running the tests.

process.env.MOCHA_FILE = './test-results/results.xml';
process.env.PROPERTIES = 'HOSTNAME=localhost';

const Mocha = require('mocha');
const mocha = new Mocha({
  reporter: 'mocha-junit-reporter'
});
mocha.addFile('./test/some-test.js');
mocha.run();

Other packages similar to mocha-junit-reporter

Keywords

FAQs

Package last updated on 12 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc