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

jest-junit

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-junit - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

19

index.js

@@ -8,6 +8,18 @@ 'use strict';

// Look for these when replacing template vars
const CLASSNAME_VAR = '{classname}';
const TITLE_VAR = '{title}';
const SUITE_NAME = process.env.JEST_SUITE_NAME || 'jest tests';
const OUTPUT_PATH = process.env.JEST_JUNIT_OUTPUT ||
path.join(process.cwd(), './junit.xml');
const CLASSNAME_TEMPLATE = process.env.JEST_JUNIT_CLASSNAME || '{classname} {title}';
const TITLE_TEMPLATE = process.env.JEST_JUNIT_TITLE || '{classname} {title}';
const replaceVars = function (str, classname, title) {
return str
.replace(CLASSNAME_VAR, classname)
.replace(TITLE_VAR, title);
};
/*

@@ -60,7 +72,10 @@ At the end of ALL of the test suites this method is called

suite.testResults.forEach((tc) => {
const classname = tc.ancestorTitles.join(' ');
const title = tc.title;
let testCase = {
'testcase': [{
_attr: {
classname: tc.fullName,
name: tc.fullName,
classname: replaceVars(CLASSNAME_TEMPLATE, classname, title),
name: replaceVars(TITLE_TEMPLATE, classname, title),
time: tc.duration / 1000

@@ -67,0 +82,0 @@ }

2

package.json
{
"name": "jest-junit",
"version": "1.1.1",
"version": "1.2.0",
"description": "A jest result processor that generates junit xml files",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -25,3 +25,3 @@ # jest-junit

jest-junit offers two configurations based on environment variables.
jest-junit offers four configurations based on environment variables.

@@ -32,2 +32,6 @@ ```JEST_SUITE_NAME```: Default "jest tests"

```JEST_JUNIT_CLASSNAME```: Default "{classname}-{title}"
```JEST_JUNIT_TITLE```: Default "{classname}-{title}"
Example:

@@ -48,1 +52,16 @@

```
Changing the title and classname
```shell
JEST_JUNIT_CLASSNAME="{classname}" JEST_JUNIT_TITLE="{title}" jest
```
```xml
<testsuites name="jest tests">
<testsuite name="foo" tests="1" errors="0" failures="0" skipped="0" timestamp="2017-02-19T22:36:15" time="0.232">
<testcase classname="foo" name="bar" time="0.003">
</testcase>
</testsuite>
</testsuites>
```
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