karma-jasmine
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -7,13 +7,12 @@ (function(window) { | ||
/** | ||
* Decision maker for whether a stack entry is considered relevant. | ||
* Decision maker for whether a stack entry is considered external to jasmine and karma. | ||
* @param {String} entry Error stack entry. | ||
* @return {Boolean} True if relevant, False otherwise. | ||
* @return {Boolean} True if external, False otherwise. | ||
*/ | ||
function isRelevantStackEntry(entry) { | ||
// discard empty and falsy entries: | ||
return (entry ? true : false) && | ||
// discard entries related to jasmine and karma-jasmine: | ||
!/\/(jasmine-core|karma-jasmine)\//.test(entry) && | ||
// discard karma specifics, e.g. "at http://localhost:7018/karma.js:185" | ||
!/\/(karma.js|context.html):/.test(entry); | ||
function isExternalStackEntry(entry) { | ||
return (entry ? true : false) && | ||
// entries related to jasmine and karma-jasmine: | ||
!/\/(jasmine-core|karma-jasmine)\//.test(entry) && | ||
// karma specifics, e.g. "at http://localhost:7018/karma.js:185" | ||
!/\/(karma.js|context.html):/.test(entry); | ||
} | ||
@@ -27,3 +26,4 @@ | ||
function getRelevantStackFrom(stack) { | ||
var relevantStack = []; | ||
var filteredStack = [], | ||
relevantStack = []; | ||
@@ -33,7 +33,19 @@ stack = stack.split('\n'); | ||
for (var i = 0; i < stack.length; i += 1) { | ||
if (isRelevantStackEntry(stack[i])) { | ||
relevantStack.push(stack[i]); | ||
if (isExternalStackEntry(stack[i])) { | ||
filteredStack.push(stack[i]); | ||
} | ||
} | ||
// If the filtered stack is empty, i.e. the error originated entirely from within jasmine or karma, then the whole stack | ||
// should be relevant. | ||
if (filteredStack.length === 0) { | ||
filteredStack = stack; | ||
} | ||
for (i = 0; i < filteredStack.length; i += 1) { | ||
if (filteredStack[i]) { | ||
relevantStack.push(filteredStack[i]); | ||
} | ||
} | ||
return relevantStack; | ||
@@ -61,4 +73,9 @@ } | ||
var relevantStack = []; | ||
var dirtyRelevantStack = getRelevantStackFrom(step.stack); | ||
// Remove the message prior to processing the stack to prevent issues like | ||
// https://github.com/karma-runner/karma-jasmine/issues/79 | ||
var stack = step.stack.replace('Error: ' + step.message, ''); | ||
var dirtyRelevantStack = getRelevantStackFrom(stack); | ||
// PhantomJS returns multiline error message for errors coming from specs | ||
@@ -88,3 +105,3 @@ // (for example when calling a non-existing function). This error is present | ||
// relevantStack: ["Error: Expected true to be false.", ...] | ||
if (relevantStack[0].indexOf(step.message) !== -1) { | ||
if (relevantStack.length && relevantStack[0].indexOf(step.message) !== -1) { | ||
// The message seems preferable, so we remove the first value from | ||
@@ -262,18 +279,2 @@ // the stack to get rid of repetition : | ||
/** | ||
* Extract grep option from karma config | ||
* @param {[Array|string]} clientArguments The karma client arguments | ||
* @return {string} The value of grep option by default empty string | ||
*/ | ||
var getGrepOption = function(clientArguments) { | ||
var clientArgString = clientArguments || ''; | ||
if (Object.prototype.toString.call(clientArguments) === '[object Array]') { | ||
clientArgString = clientArguments.join('='); | ||
} | ||
var match = /--grep=(.*)/.exec(clientArgString); | ||
return match ? match[1] : ''; | ||
}; | ||
/** | ||
* Create jasmine spec filter | ||
@@ -331,2 +332,2 @@ * @param {Object} options Spec filter options | ||
})(window); | ||
})(typeof window !== 'undefined' ? window : global); |
@@ -43,2 +43,2 @@ /** | ||
}(window)); | ||
}(typeof window !== 'undefined' ? window : global)); |
{ | ||
"name": "karma-jasmine", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "A Karma plugin - adapter for Jasmine testing framework.", | ||
@@ -23,3 +23,3 @@ "main": "lib/index.js", | ||
"grunt-contrib-jshint": "~0.6", | ||
"karma": "~0.12.0", | ||
"karma": "", | ||
"karma-jasmine": "~0.1.0", | ||
@@ -35,3 +35,2 @@ "karma-chrome-launcher": "~0.1.0", | ||
"peerDependencies": { | ||
"karma": ">=0.9", | ||
"jasmine-core": "*" | ||
@@ -45,12 +44,19 @@ }, | ||
"Friedel Ziegelmayer <friedel.ziegelmayer@gmail.com>", | ||
"Alesei N <github.com@bzik.net>", | ||
"Barry Fitzgerald <barfitzgerald@gmail.com>", | ||
"Marek Vavrecan <vavrecan@gmail.com>", | ||
"Niels Dequeker <niels.dequeker@gmail.com>", | ||
"Richard Park <objectiv@gmail.com>", | ||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>", | ||
"Robin Gloster <robin@loc-com.de>", | ||
"Sahat Yalkabov <sakhat@gmail.com>", | ||
"Sergey Tatarintsev <sevinf@yandex-team.ru>", | ||
"Stefan Dragnev <dragnev@telerik.com>", | ||
"dignifiedquire <dignifiedquire@gmail.com>", | ||
"jiverson <jiverson222@gmail.com>", | ||
"rpark <objectiv@gmail.com>" | ||
"Aaron Hartwig <aaron.hartwig@whyhigh.com>", | ||
"rpark <objectiv@gmail.com>", | ||
"Alesei N <github.com@bzik.net>", | ||
"Barry Fitzgerald <barfitzgerald@gmail.com>", | ||
"Marek Vavrecan <vavrecan@gmail.com>", | ||
"Mark Ethan Trostler <mark@zzo.com>", | ||
"Matthew Hill <Matthew.Hill4@bskyb.com>", | ||
"Niels Dequeker <niels.dequeker@gmail.com>" | ||
] | ||
} |
@@ -21,3 +21,3 @@ # karma-jasmine [![Build Status](https://travis-ci.org/karma-runner/karma-jasmine.svg?branch=master)](https://travis-ci.org/karma-runner/karma-jasmine) | ||
You can simple do it by: | ||
You can simply do it by: | ||
```bash | ||
@@ -40,3 +40,3 @@ npm install karma-jasmine --save-dev | ||
You can simple do it by: | ||
You can simply do it by: | ||
```bash | ||
@@ -47,3 +47,3 @@ npm install karma-jasmine@2_0 --save-dev | ||
__Note:__ | ||
Since `karma-jasmine 0.3.0` the jasmine library is no longer bundled with `karma-jasmine` and you have to install it on your own. You can simple do it by: | ||
Since `karma-jasmine 0.3.0` the jasmine library is no longer bundled with `karma-jasmine` and you have to install it on your own. You can simply do it by: | ||
```bash | ||
@@ -66,3 +66,3 @@ npm install jasmine-core --save-dev | ||
If you want run only some tests matching a given pattern you can do this in the following way | ||
If you want to run only some tests matching a given pattern you can do this in the following way | ||
@@ -69,0 +69,0 @@ ```bash |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
15875
1
1