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

xunit-file

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xunit-file - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

lib/file-path-parser.js

4

lib/xunit-file.js

@@ -13,3 +13,5 @@ /**

, mkdirp = require("mkdirp")
, filePath = process.env.XUNIT_FILE || config.file || process.cwd() + "/xunit.xml"
, dateFormat = require('dateformat')
, filePathParser = require('./file-path-parser')(process, global.Date, dateFormat)
, filePath = filePathParser(process.env.XUNIT_FILE || config.file || "${cwd}/xunit.xml")
, consoleOutput = process.env.XUNIT_SILENT ? {} : config.consoleOutput || {};

@@ -16,0 +18,0 @@

{
"name": "xunit-file",
"description": "Basically the same reporter as mocha's xunit reporter, but writes the output in a file.",
"version": "0.0.10",
"version": "0.0.11",
"author": {

@@ -21,2 +21,6 @@ "name": "Matthias Jahn",

"email": "peter.janes@ek3.com"
},
{
"name": "Nathan Fairhurst",
"email": "nathan.p3pictures@gmail.com"
}

@@ -34,6 +38,8 @@ ],

"dependencies": {
"dateformat": "^1.0.12",
"mkdirp": "^0.5.1"
},
"devDependencies": {
"mocha": "^2.2.5"
"mocha": "^2.2.5",
"sinon": "^1.17.3"
},

@@ -40,0 +46,0 @@ "scripts": {

@@ -26,3 +26,3 @@ xunit-file

{
"file" : "xunit.xml",
"file" : "${cwd}/xunit.xml",
"consoleOutput" : {

@@ -70,3 +70,26 @@ "suite" : true,

**File Path Options**
The file path accepts a few custom tokens to allow creation of dynamic file names. This can be useful for multithreaded testing (such as using a Selenium Grid) or to keep multiple files by timestamp. Tokens are in the following format:
```
${tokenName: 'Token Data'}
```
The available tokens are `pid` to inject the process id, `cwd` to inject the current working directory, and `ts` or `timestamp` to inject a timestamp.
By default `ts` and `timestamp` use the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, ex: `2016-03-31T07:27:48+00:00`. However, if you specify a custom format in the Token Data, the timestamp uses the [node dateformat](https://github.com/felixge/node-dateformat) library to output a string in that format.
A full example `config.json` is as follows:
```
{
"file": "${cwd}/${timestamp: 'MMDD-hhmm'}/xunit-${pid}.xml"
}
```
This would output something like `~/myProject/1217-1507/xunit-1234.xml`. This example would keep copies good for a year without collision, and group multithreaded results by test run.
Tokens can be used in either environment variables or a config.json. The default filepath is always `${cwd}/xunit.xml`.
# Credits

@@ -73,0 +96,0 @@ This reporter is just the original [xunit reporter](https://github.com/visionmedia/mocha/blob/master/lib/reporters/xunit.js) from mocha only writing the result in an xml file.

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