karma-mocha-reporter
Advanced tools
Comparing version 2.0.0 to 2.0.1
43
index.js
@@ -212,2 +212,26 @@ 'use strict'; | ||
/** | ||
* Checks if all items are completed | ||
* | ||
* @param {object} items The item objects | ||
* @returns {boolean} | ||
*/ | ||
function allChildItemsAreCompleted (items) { | ||
var item; | ||
var isCompleted = true; | ||
Object.keys(items).forEach(function(key){ | ||
item = items[key]; | ||
if (item.type === 'it') { | ||
isCompleted = isCompleted && item.isCompleted; | ||
} else if (item.items) { | ||
// recursive check of child items | ||
isCompleted = isCompleted && allChildItemsAreCompleted(item.items); | ||
} | ||
}); | ||
return isCompleted; | ||
} | ||
/** | ||
* Writes the test results to the output | ||
@@ -233,2 +257,7 @@ * | ||
if (item.name && !item.printed && (!item.skipped || !ignoreSkipped)) { | ||
// only print it block when it was ran through all browsers | ||
if (item.type === 'it' && !item.isCompleted) { | ||
return; | ||
} | ||
// indent | ||
@@ -259,4 +288,8 @@ var line = repeatString(' ', depth) + item.name; | ||
if (item.items) { | ||
// print all child items | ||
print(item.items, depth + 1); | ||
var allChildItemsCompleted = allChildItemsAreCompleted(item.items); | ||
if (allChildItemsCompleted) { | ||
// print all child items | ||
print(item.items, depth + 1); | ||
} | ||
} | ||
@@ -440,4 +473,4 @@ } | ||
item.failed = item.failed || []; | ||
item.name = (result.success ? getLogSymbol(colors.success) : getLogSymbol(colors.error)) + ' ' + item.name; | ||
item.success = result.success; | ||
item.success = result.success && item.success; | ||
item.name = (item.success ? getLogSymbol(colors.success) : getLogSymbol(colors.error)) + ' ' + item.name; | ||
item.skipped = result.skipped; | ||
@@ -470,2 +503,4 @@ item.visited = item.visited || []; | ||
if (item.count === self.numberOfBrowsers) { | ||
item.isCompleted = true; | ||
// print results to output when test was ran through all browsers | ||
@@ -472,0 +507,0 @@ if (outputMode !== 'minimal') { |
{ | ||
"name": "karma-mocha-reporter", | ||
"description": "Karma reporter with mocha style logging.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"homepage": "http://www.litixsoft.de/modules-karmamochareporter", | ||
@@ -54,3 +54,3 @@ "author": "Litixsoft GmbH <info@litixsoft.de> (http://www.litixsoft.de)", | ||
"chai": "^3.5.0", | ||
"grunt": "^0.4.5", | ||
"grunt": "^1.0.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
@@ -76,3 +76,3 @@ "grunt-contrib-jshint": "^1.0.0", | ||
"dependencies": { | ||
"chalk": "1.1.1" | ||
"chalk": "1.1.3" | ||
}, | ||
@@ -79,0 +79,0 @@ "peerDependencies": { |
@@ -210,2 +210,5 @@ # karma-mocha-reporter | ||
## Release History | ||
### v2.0.1 | ||
* Print correct failure summary and colors when a test fails only in one browser | ||
### v2.0.0 | ||
@@ -212,0 +215,0 @@ * Move module karma to peerDependencies |
32457
518
333
+ Added@types/node@22.13.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedobject-inspect@1.13.4(transitive)
- Removed@types/node@22.12.0(transitive)
- Removedchalk@1.1.1(transitive)
- Removedobject-inspect@1.13.3(transitive)
Updatedchalk@1.1.3