karma-mocha-reporter
Advanced tools
Comparing version 0.2.5 to 0.2.6
33
index.js
@@ -168,2 +168,30 @@ 'use strict'; | ||
/** | ||
* Returns all properties of the given object | ||
* | ||
* @param {!Object} obj | ||
* @returns {Array} | ||
*/ | ||
function listAllObjectProperties (obj) { | ||
var objectToInspect; | ||
var result = []; | ||
for (objectToInspect = obj; objectToInspect !== null; objectToInspect = Object.getPrototypeOf(objectToInspect)) { | ||
result = result.concat(Object.getOwnPropertyNames(objectToInspect)); | ||
} | ||
return result; | ||
} | ||
/** | ||
* Returns if the property is an reserverd object property | ||
* | ||
* @param {!Object} obj | ||
* @param {!String} property | ||
* @returns {boolean} | ||
*/ | ||
function isReservedProperty (obj, property) { | ||
return listAllObjectProperties(Object.getPrototypeOf(obj)).indexOf(property) > -1; | ||
} | ||
/** | ||
* Called each time a test is completed in a given browser. | ||
@@ -180,2 +208,7 @@ * | ||
path.reduce(function (suite, description, depth) { | ||
if (isReservedProperty(suite, description)) { | ||
self.write(chalk.yellow('Reserved name for ' + (depth === maxDepth ? 'it' : 'describe') + ' block (' + description + ')! Please use an other name, othwerwhise the result are not printed correctly\n')); | ||
return {}; | ||
} | ||
var item = suite[description] || {}; | ||
@@ -182,0 +215,0 @@ suite[description] = item; |
{ | ||
"name": "karma-mocha-reporter", | ||
"description": "Karma reporter with mocha style logging.", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"homepage": "http://www.litixsoft.de/modules-karmamochareporter", | ||
@@ -47,3 +47,3 @@ "author": "Litixsoft GmbH <info@litixsoft.de> (http://www.litixsoft.de)", | ||
"devDependencies": { | ||
"grunt": "^0.4.4", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-copy": "^0.5.0", | ||
@@ -50,0 +50,0 @@ "grunt-contrib-jshint": "^0.10.0", |
@@ -53,2 +53,5 @@ # karma-mocha-reporter | ||
## Release History | ||
### v0.2.6 | ||
* don't crash when the name of the describe or it block is a reserved object property (e.g. constructor, toString) | ||
### v0.2.5 | ||
@@ -55,0 +58,0 @@ * results summary is now also printed when all tests fail |
15943
261
102