Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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
import builder from 'junit-report-builder';
// Create a test suite
let suite = builder.testSuite().name('My suite');
// Create a test case
let firstTestCase = suite.testCase()
.className('my.test.Class')
.name('My first test');
// Create another test case which is marked as failed
let secondTestCase = 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 tests="2" failures="1" errors="0" skipped="0">
<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:
// Each builder produces a single report file
let anotherBuilder = builder.newBuilder();
CommonJS is also supported:
let builder = require('junit-report-builder');
Please refer to the e2e.spec.ts for more details on the usage.
markdown-doctest
from a dependency to a dev dependency.value
attribute. Thanks to Sebastian Sauer.index.d.ts
. Thanks to Harel Mazor and Simeon Cheeseman.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
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.