js-reporters
Advanced tools
Comparing version 1.0.0 to 1.0.1
/** | ||
* JsReporters 1.0.0 | ||
* JsReporters 1.0.1 | ||
* https://github.com/js-reporters | ||
@@ -9,3 +9,3 @@ * | ||
* | ||
* Date: Sun Jul 10 2016 | ||
* Date: Fri Jul 15 2016 | ||
*/ | ||
@@ -448,36 +448,18 @@ | ||
var skipped = 0; | ||
var tests = this.getAllTests(); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var i = 0; i < tests.length; i++) { | ||
var test = tests[i]; | ||
try { | ||
for (var _iterator = this.getAllTests()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var test = _step.value; | ||
// If a suite contains a test whose status is still undefined, | ||
// there is no final status for the suite as well. | ||
if (test.status === undefined) { | ||
return undefined; | ||
} else if (test.status === 'passed') { | ||
passed++; | ||
} else if (test.status === 'skipped') { | ||
skipped++; | ||
} else { | ||
failed++; | ||
} | ||
// If a suite contains a test whose status is still undefined, | ||
// there is no final status for the suite as well. | ||
if (test.status === undefined) { | ||
return undefined; | ||
} else if (test.status === 'passed') { | ||
passed++; | ||
} else if (test.status === 'skipped') { | ||
skipped++; | ||
} else { | ||
failed++; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -585,27 +567,6 @@ | ||
// The suiteName of global tests must be undefined. | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
globalSuite.tests.forEach(function (test) { | ||
test.suiteName = undefined; | ||
}); | ||
try { | ||
for (var _iterator = globalSuite.tests[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var test = _step.value; | ||
test.suiteName = undefined; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
modules = this.QUnit.config.modules.slice(1); | ||
@@ -630,68 +591,26 @@ } else { | ||
// this means that this suite is the direct child of the global suite. | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
suites.forEach(function (suite) { | ||
var indexEnd = suite.name.lastIndexOf(' > '); | ||
try { | ||
for (var _iterator2 = suites[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var suite = _step2.value; | ||
if (indexEnd !== -1) { | ||
// Find the ' > ' characters that appears before the parent name. | ||
var indexStart = suite.name.substring(0, indexEnd).lastIndexOf(' > '); | ||
// If it is -1, the parent suite name starts at 0, else escape | ||
// this characters ' > '. | ||
indexStart = indexStart === -1 ? 0 : indexStart + 3; | ||
var indexEnd = suite.name.lastIndexOf(' > '); | ||
var parentSuiteName = suite.name.substring(indexStart, indexEnd); | ||
if (indexEnd !== -1) { | ||
// Find the ' > ' characters that appears before the parent name. | ||
var indexStart = suite.name.substring(0, indexEnd).lastIndexOf(' > '); | ||
// If it is -1, the parent suite name starts at 0, else escape | ||
// this characters ' > '. | ||
indexStart = indexStart === -1 ? 0 : indexStart + 3; | ||
// Keep only the name of the suite itself. | ||
suite.name = suite.name.substring(indexEnd + 3); | ||
var parentSuiteName = suite.name.substring(indexStart, indexEnd); | ||
// Keep only the name of the suite itself. | ||
suite.name = suite.name.substring(indexEnd + 3); | ||
var _iteratorNormalCompletion3 = true; | ||
var _didIteratorError3 = false; | ||
var _iteratorError3 = undefined; | ||
try { | ||
for (var _iterator3 = suites[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
var parentSuite = _step3.value; | ||
if (parentSuite.name === parentSuiteName) { | ||
parentSuite.childSuites.push(suite); | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError3 = true; | ||
_iteratorError3 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
_iterator3.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError3) { | ||
throw _iteratorError3; | ||
} | ||
} | ||
suites.forEach(function (parentSuite) { | ||
if (parentSuite.name === parentSuiteName) { | ||
parentSuite.childSuites.push(suite); | ||
} | ||
} else { | ||
topLevelSuites.push(suite); | ||
} | ||
}); | ||
} else { | ||
topLevelSuites.push(suite); | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
}); | ||
@@ -725,54 +644,14 @@ globalSuite.childSuites = topLevelSuites; | ||
value: function emitData(suite) { | ||
var _iteratorNormalCompletion4 = true; | ||
var _didIteratorError4 = false; | ||
var _iteratorError4 = undefined; | ||
var _this3 = this; | ||
try { | ||
for (var _iterator4 = suite.tests[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
var test = _step4.value; | ||
suite.tests.forEach(function (test) { | ||
_this3.emit('testStart', _this3.createTestStart(test)); | ||
_this3.emit('testEnd', _this3.createTestEnd(test)); | ||
}); | ||
this.emit('testStart', this.createTestStart(test)); | ||
this.emit('testEnd', this.createTestEnd(test)); | ||
} | ||
} catch (err) { | ||
_didIteratorError4 = true; | ||
_iteratorError4 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
_iterator4.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError4) { | ||
throw _iteratorError4; | ||
} | ||
} | ||
} | ||
var _iteratorNormalCompletion5 = true; | ||
var _didIteratorError5 = false; | ||
var _iteratorError5 = undefined; | ||
try { | ||
for (var _iterator5 = suite.childSuites[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { | ||
var _suite = _step5.value; | ||
this.emit('suiteStart', this.createSuiteStart(_suite)); | ||
this.emitData(_suite); | ||
this.emit('suiteEnd', this.createSuiteEnd(_suite)); | ||
} | ||
} catch (err) { | ||
_didIteratorError5 = true; | ||
_iteratorError5 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion5 && _iterator5.return) { | ||
_iterator5.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError5) { | ||
throw _iteratorError5; | ||
} | ||
} | ||
} | ||
suite.childSuites.forEach(function (childSuite) { | ||
_this3.emit('suiteStart', _this3.createSuiteStart(childSuite)); | ||
_this3.emitData(childSuite); | ||
_this3.emit('suiteEnd', _this3.createSuiteEnd(childSuite)); | ||
}); | ||
} | ||
@@ -892,45 +771,26 @@ }, { | ||
value: function createGlobalSuite(jasmineSuite) { | ||
var _this2 = this; | ||
var childSuites = []; | ||
var tests = []; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
jasmineSuite.children.forEach(function (child) { | ||
if (child.id.indexOf('suite') === 0) { | ||
childSuites.push(_this2.createGlobalSuite(child)); | ||
} else { | ||
var suiteName = void 0; | ||
var test = void 0; | ||
try { | ||
for (var _iterator = jasmineSuite.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var child = _step.value; | ||
// Jasmine full description is of form "suite1 suite2 ... suiteN test", | ||
// for the "suiteName" property we need to remove test name. | ||
if (!_this2.isJasmineGlobalSuite(jasmineSuite)) { | ||
suiteName = child.result.fullName.substring(0, child.result.fullName.indexOf(child.description) - 1); | ||
} | ||
if (child.id.indexOf('suite') === 0) { | ||
childSuites.push(this.createGlobalSuite(child)); | ||
} else { | ||
var suiteName = void 0; | ||
var test = void 0; | ||
test = new Test(child.description, suiteName); | ||
// Jasmine full description is of form "suite1 suite2 ... suiteN test", | ||
// for the "suiteName" property we need to remove test name. | ||
if (!this.isJasmineGlobalSuite(jasmineSuite)) { | ||
suiteName = child.result.fullName.substring(0, child.result.fullName.indexOf(child.description) - 1); | ||
} | ||
test = new Test(child.description, suiteName); | ||
tests.push(test); | ||
this.tests[child.id] = test; | ||
} | ||
tests.push(test); | ||
_this2.tests[child.id] = test; | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
}); | ||
@@ -1152,29 +1012,8 @@ var name = this.isJasmineGlobalSuite(jasmineSuite) ? undefined : jasmineSuite.description; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
try { | ||
for (var _iterator = test.errors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var error = _step.value; | ||
console.log(' ---'); | ||
console.log(' message: "' + error.toString() + '"'); | ||
console.log(' severity: failed'); | ||
console.log(' ...'); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
test.errors.forEach(function (error) { | ||
console.log(' ---'); | ||
console.log(' message: "' + error.toString() + '"'); | ||
console.log(' severity: failed'); | ||
console.log(' ...'); | ||
}); | ||
} | ||
@@ -1181,0 +1020,0 @@ } |
@@ -79,3 +79,3 @@ import EventEmitter from 'events' | ||
for (let child of jasmineSuite.children) { | ||
jasmineSuite.children.forEach((child) => { | ||
if (child.id.indexOf('suite') === 0) { | ||
@@ -100,3 +100,3 @@ childSuites.push(this.createGlobalSuite(child)) | ||
} | ||
} | ||
}) | ||
@@ -103,0 +103,0 @@ let name = (this.isJasmineGlobalSuite(jasmineSuite)) ? undefined |
@@ -68,5 +68,5 @@ import EventEmitter from 'events' | ||
// The suiteName of global tests must be undefined. | ||
for (let test of globalSuite.tests) { | ||
globalSuite.tests.forEach(function (test) { | ||
test.suiteName = undefined | ||
} | ||
}) | ||
@@ -92,3 +92,3 @@ modules = this.QUnit.config.modules.slice(1) | ||
// this means that this suite is the direct child of the global suite. | ||
for (let suite of suites) { | ||
suites.forEach(function (suite) { | ||
let indexEnd = suite.name.lastIndexOf(' > ') | ||
@@ -108,11 +108,11 @@ | ||
for (let parentSuite of suites) { | ||
suites.forEach(function (parentSuite) { | ||
if (parentSuite.name === parentSuiteName) { | ||
parentSuite.childSuites.push(suite) | ||
} | ||
} | ||
}) | ||
} else { | ||
topLevelSuites.push(suite) | ||
} | ||
} | ||
}) | ||
@@ -150,12 +150,12 @@ globalSuite.childSuites = topLevelSuites | ||
emitData (suite) { | ||
for (let test of suite.tests) { | ||
suite.tests.forEach((test) => { | ||
this.emit('testStart', this.createTestStart(test)) | ||
this.emit('testEnd', this.createTestEnd(test)) | ||
} | ||
}) | ||
for (let suite of suite.childSuites) { | ||
this.emit('suiteStart', this.createSuiteStart(suite)) | ||
this.emitData(suite) | ||
this.emit('suiteEnd', this.createSuiteEnd(suite)) | ||
} | ||
suite.childSuites.forEach((childSuite) => { | ||
this.emit('suiteStart', this.createSuiteStart(childSuite)) | ||
this.emitData(childSuite) | ||
this.emit('suiteEnd', this.createSuiteEnd(childSuite)) | ||
}) | ||
} | ||
@@ -162,0 +162,0 @@ |
@@ -51,4 +51,7 @@ export class Test { | ||
var skipped = 0 | ||
var tests = this.getAllTests() | ||
for (let test of this.getAllTests()) { | ||
for (let i = 0; i < tests.length; i++) { | ||
let test = tests[i] | ||
// If a suite contains a test whose status is still undefined, | ||
@@ -55,0 +58,0 @@ // there is no final status for the suite as well. |
@@ -30,3 +30,3 @@ export default class TapReporter { | ||
for (let error of test.errors) { | ||
test.errors.forEach(function (error) { | ||
console.log(' ---') | ||
@@ -36,3 +36,3 @@ console.log(` message: "${error.toString()}"`) | ||
console.log(' ...') | ||
} | ||
}) | ||
} | ||
@@ -39,0 +39,0 @@ } |
{ | ||
"name": "js-reporters", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "common reporter interface for javascript testing frameworks", | ||
@@ -5,0 +5,0 @@ "main": "dist/js-reporters.js", |
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
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
354110
2404