Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
junit-report-builder
Advanced tools
Aimed at making it easier to build Jenkins compatible JUnit XML reports in plugins for testing frameworks
The junit-report-builder npm package is a tool for creating JUnit XML reports. These reports are commonly used in continuous integration (CI) systems to display test results. The package allows you to programmatically build and structure these reports, making it easier to integrate with various CI tools.
Creating a Test Suite
This feature allows you to create a new test suite. A test suite is a collection of test cases that can be reported together.
const builder = require('junit-report-builder');
const suite = builder.testSuite().name('My Test Suite');
Adding Test Cases
This feature allows you to add test cases to a test suite. You can specify the class name, test name, execution time, and the result of the test (e.g., failure message).
const builder = require('junit-report-builder');
const suite = builder.testSuite().name('My Test Suite');
suite.testCase().className('MyClass').name('should do something').time(123).failure('Failure message');
Writing the Report to a File
This feature allows you to write the constructed JUnit report to an XML file. This file can then be used by CI tools to display test results.
const builder = require('junit-report-builder');
const suite = builder.testSuite().name('My Test Suite');
suite.testCase().className('MyClass').name('should do something').time(123).failure('Failure message');
builder.writeTo('test-report.xml');
The mocha-junit-reporter package is a reporter for the Mocha testing framework that generates JUnit XML reports. It is specifically designed to work with Mocha, making it a good choice if you are already using Mocha for your tests. Unlike junit-report-builder, which is a general-purpose JUnit report builder, mocha-junit-reporter is tightly integrated with Mocha.
The jest-junit package is a Jest reporter that generates JUnit XML reports. It is designed to work seamlessly with the Jest testing framework. If you are using Jest for your tests, jest-junit provides a straightforward way to generate JUnit reports without needing to manually build them, as you would with junit-report-builder.
The junit-xml package is a Python library for creating JUnit XML reports. While it is not a direct npm package, it serves a similar purpose in the Python ecosystem. It allows you to programmatically create JUnit reports, similar to junit-report-builder, but is used in Python projects.
A project aimed at making it easier to build Jenkins compatible XML based JUnit reports.
To install the latest version, run:
npm install junit-report-builder --save
var builder = require('junit-report-builder');
// Create a test suite
var suite = builder.testSuite().name('My suite');
// Create a test case
var testCase = suite.testCase()
.className('my.test.Class')
.name('My first test');
// Create another test case which is marked as failed
var testCase = suite.testCase()
.className('my.test.Class')
.name('My second test')
.failure();
builder.writeTo('test-report.xml');
This will create test-report.xml
containing the following:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="My suite" tests="2" failures="1" errors="0" skipped="0">
<testcase classname="my.test.Class" name="My first test"/>
<testcase classname="my.test.Class" name="My second test">
<failure/>
</testcase>
</testsuite>
</testsuites>
If you want to create another report file, start by getting a new builder instance like this:
builder = builder.newBuilder();
Please refer to the e2e_spec.coffee for more details on the usage.
file
attribute to a test case. Thanks to Ben Holland.Thanks to Robert Turner.
date-format
to be a dependency. Previously it was incorrectly set to be a devDependency. Thanks to georgecrawford.FAQs
Aimed at making it easier to build Jenkins compatible JUnit XML reports in plugins for testing frameworks
The npm package junit-report-builder receives a total of 518,696 weekly downloads. As such, junit-report-builder popularity was classified as popular.
We found that junit-report-builder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.