xunit-file
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -11,4 +11,5 @@ /** | ||
, fs = require("fs") | ||
, path = require("path") | ||
, mkdirp = require("mkdirp") | ||
, filePath = process.env.XUNIT_FILE || config.file || process.cwd() + "/xunit.xml" | ||
, fd = fs.openSync(filePath, 'w', 0755) | ||
, consoleOutput = config.consoleOutput || {}; | ||
@@ -43,4 +44,7 @@ | ||
, tests = [] | ||
, self = this; | ||
, fd; | ||
mkdirp.sync(path.dirname(filePath)); | ||
fd = fs.openSync(filePath, 'w', 0755); | ||
runner.on('suite', function(suite){ | ||
@@ -75,3 +79,3 @@ if(consoleOutput.suite){ | ||
appendLine(tag('testsuite', { | ||
appendLine(fd, tag('testsuite', { | ||
name: process.env.SUITE_NAME || 'Mocha Tests' | ||
@@ -86,4 +90,7 @@ , tests: stats.tests | ||
tests.forEach(test); | ||
appendLine('</testsuite>'); | ||
tests.forEach(function(test){ | ||
writeTest(fd, test); | ||
}); | ||
appendLine(fd, '</testsuite>'); | ||
fs.closeSync(fd); | ||
@@ -103,3 +110,3 @@ }); | ||
function test(test) { | ||
function writeTest(fd, test) { | ||
var attrs = { | ||
@@ -114,8 +121,8 @@ classname: test.parent.fullTitle() | ||
var err = test.err; | ||
appendLine(tag('testcase', attrs, false, tag('failure', { message: escape(err.message) }, false, cdata(err.stack)))); | ||
appendLine(fd, tag('testcase', attrs, false, tag('failure', { message: escape(err.message) }, false, cdata(err.stack)))); | ||
} else if (test.pending) { | ||
delete attrs.time; | ||
appendLine(tag('testcase', attrs, false, tag('skipped', {}, true))); | ||
appendLine(fd, tag('testcase', attrs, false, tag('skipped', {}, true))); | ||
} else { | ||
appendLine(tag('testcase', attrs, true) ); | ||
appendLine(fd, tag('testcase', attrs, true) ); | ||
} | ||
@@ -131,3 +138,3 @@ } | ||
, pairs = [] | ||
, tag; | ||
, result; | ||
@@ -138,5 +145,5 @@ for (var key in attrs) { | ||
tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; | ||
if (content) tag += content + '</' + name + end; | ||
return tag; | ||
result = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; | ||
if (content) result += content + '</' + name + end; | ||
return result; | ||
} | ||
@@ -152,3 +159,3 @@ | ||
function appendLine(line) { | ||
function appendLine(fd, line) { | ||
if (process.env.LOG_XUNIT) { | ||
@@ -155,0 +162,0 @@ console.log(line); |
{ | ||
"name": "xunit-file", | ||
"description": "Basically the same reporter as mocha's xunit reporter, but writes the output in a file.", | ||
"version": "0.0.6", | ||
"author": { | ||
"name": "Matthias Jahn", | ||
"email": "matthias.jahn@peerigon.com" | ||
"name": "xunit-file", | ||
"description": "Basically the same reporter as mocha's xunit reporter, but writes the output in a file.", | ||
"version": "0.0.7", | ||
"author": { | ||
"name": "Matthias Jahn", | ||
"email": "matthias.jahn@peerigon.com" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Matthias Jahn", | ||
"email": "matthias.jahn@peerigon.com" | ||
}, | ||
"contributors": [ | ||
{ "name": "Matthias Jahn", "email": "matthias.jahn@peerigon.com" }, | ||
{ "name": "Paul Torka", "email": "paul.torka@yahoo.de" }, | ||
{ "name": "Peter Janes", "email": "peter.janes@ek3.com" } | ||
], | ||
"keywords" : ["mocha", "xunit", "file", "reporter"], | ||
"main" : "lib/xunit-file.js", | ||
"repository" : "git://github.com/peerigon/xunit-file.git", | ||
"license": "MIT" | ||
{ | ||
"name": "Paul Torka", | ||
"email": "paul.torka@yahoo.de" | ||
}, | ||
{ | ||
"name": "Peter Janes", | ||
"email": "peter.janes@ek3.com" | ||
} | ||
], | ||
"keywords": [ | ||
"mocha", | ||
"xunit", | ||
"file", | ||
"reporter" | ||
], | ||
"main": "lib/xunit-file.js", | ||
"repository": "git://github.com/peerigon/xunit-file.git", | ||
"license": "MIT", | ||
"dependencies": { | ||
"mkdirp": "^0.5.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^2.2.5" | ||
}, | ||
"scripts": { | ||
"test": "rm -rf _tmp && mocha test/*.spec.js" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171
23040
1
1
18
8
1
+ Addedmkdirp@^0.5.1
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)