Browse Source

[build]

master
Muthu Kumar 6 years ago
parent
commit
a90706dcf4
  1. 19
      browser/index.js
  2. 19
      es5/reporters/xunit.js
  3. 2
      package.json

19
browser/index.js

@ -2442,6 +2442,10 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera
var _require9 = require('../util/nodeutils'), var _require9 = require('../util/nodeutils'),
clear = _require9.clear; clear = _require9.clear;
var escapeXML = function escapeXML(str) {
return str.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
};
var toJSON = function toJSON(resultsArray) { var toJSON = function toJSON(resultsArray) {
return { return {
testsuites: resultsArray.map(function (results) { testsuites: resultsArray.map(function (results) {
@ -2453,7 +2457,7 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera
return { return {
name: 'testsuite', name: 'testsuite',
attrs: { attrs: {
name: name, name: escapeXML(name),
tests: count, tests: count,
success: success.length, success: success.length,
failures: failures.length, failures: failures.length,
@ -2463,20 +2467,17 @@ function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.itera
}, },
children: results.reduce(function (acc, r) { children: results.reduce(function (acc, r) {
var reason = r.reason ? r.reason.stack || r.reason : ''; var reason = r.reason ? r.reason.stack || r.reason : '';
var content = r.status !== 'ok' && r.status === 'skip' ? { var content = r.status !== 'ok' && {
name: 'skipped', name: r.status === 'skip' ? 'skipped' : 'failure',
text: reason text: escapeXML(reason)
} : {
name: 'failure',
text: reason
}; };
acc.push(_objectSpread({ acc.push(_objectSpread({
name: 'testcase', name: 'testcase',
attrs: { attrs: {
name: r.description, name: escapeXML(r.description),
time: r.duration / 1000 || 0 time: r.duration / 1000 || 0
} }
}, _typeof2(content) === 'object' && content, _typeof2(content) === 'object' && { }, _typeof2(content) === 'object' && {
children: [content] children: [content]
})); }));
return acc; return acc;

19
es5/reporters/xunit.js

@ -11,6 +11,10 @@ var toXML = require('jsontoxml');
var _require = require('../util/nodeutils'), var _require = require('../util/nodeutils'),
clear = _require.clear; clear = _require.clear;
var escapeXML = function escapeXML(str) {
return str.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
};
var toJSON = function toJSON(resultsArray) { var toJSON = function toJSON(resultsArray) {
return { return {
testsuites: resultsArray.map(function (results) { testsuites: resultsArray.map(function (results) {
@ -22,7 +26,7 @@ var toJSON = function toJSON(resultsArray) {
return { return {
name: 'testsuite', name: 'testsuite',
attrs: { attrs: {
name: name, name: escapeXML(name),
tests: count, tests: count,
success: success.length, success: success.length,
failures: failures.length, failures: failures.length,
@ -32,20 +36,17 @@ var toJSON = function toJSON(resultsArray) {
}, },
children: results.reduce(function (acc, r) { children: results.reduce(function (acc, r) {
var reason = r.reason ? r.reason.stack || r.reason : ''; var reason = r.reason ? r.reason.stack || r.reason : '';
var content = r.status !== 'ok' && r.status === 'skip' ? { var content = r.status !== 'ok' && {
name: 'skipped', name: r.status === 'skip' ? 'skipped' : 'failure',
text: reason text: escapeXML(reason)
} : {
name: 'failure',
text: reason
}; };
acc.push(_objectSpread({ acc.push(_objectSpread({
name: 'testcase', name: 'testcase',
attrs: { attrs: {
name: r.description, name: escapeXML(r.description),
time: r.duration / 1000 || 0 time: r.duration / 1000 || 0
} }
}, _typeof(content) === 'object' && content, _typeof(content) === 'object' && { }, _typeof(content) === 'object' && {
children: [content] children: [content]
})); }));
return acc; return acc;

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "@klenty/gunner", "name": "@klenty/gunner",
"version": "0.11.10", "version": "0.11.11",
"description": "Zero magic, fast test-runner and assertion framework. No magic globals.", "description": "Zero magic, fast test-runner and assertion framework. No magic globals.",
"main": "index.js", "main": "index.js",
"repository": { "repository": {

Loading…
Cancel
Save