File jasmine-3381524e041727d93e4b14f37a44f36704129672035b60bc98fbf476d6d011da.js
has 2891 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright (c) 2008-2016 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Function matchersUtil
has a Cognitive Complexity of 130 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().matchersUtil = function(j$) {
// TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
return {
equals: function(a, b, customTesters) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Env
has 423 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Env = function(j$) {
function Env(options) {
options = options || {};
var self = this;
Function Env
has 420 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Env(options) {
options = options || {};
var self = this;
var global = options.global || j$.getGlobal();
Function Env
has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Env = function(j$) {
function Env(options) {
options = options || {};
var self = this;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TreeProcessor
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().TreeProcessor = function() {
function TreeProcessor(attrs) {
var tree = attrs.tree,
runnableIds = attrs.runnableIds,
queueRunnerFactory = attrs.queueRunnerFactory,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function toThrowError
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().toThrowError = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toThrowError>', 'expect(function() {<expectation>}).toThrowError(<ErrorConstructor>, <message>)');
function toThrowError () {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function pp
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().pp = function(j$) {
function PrettyPrinter() {
this.ppNestLevel_ = 0;
this.seen = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function matchersUtil
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().matchersUtil = function(j$) {
// TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
return {
equals: function(a, b, customTesters) {
Function DelayedFunctionScheduler
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().DelayedFunctionScheduler = function() {
function DelayedFunctionScheduler() {
var self = this;
var scheduledLookup = [];
var scheduledFunctions = {};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Suite
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Suite = function(j$) {
function Suite(attrs) {
this.env = attrs.env;
this.id = attrs.id;
this.parentSuite = attrs.parentSuite;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TreeProcessor
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().TreeProcessor = function() {
function TreeProcessor(attrs) {
var tree = attrs.tree,
runnableIds = attrs.runnableIds,
queueRunnerFactory = attrs.queueRunnerFactory,
Function TreeProcessor
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TreeProcessor(attrs) {
var tree = attrs.tree,
runnableIds = attrs.runnableIds,
queueRunnerFactory = attrs.queueRunnerFactory,
nodeStart = attrs.nodeStart || function() {},
Function Suite
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Suite = function(j$) {
function Suite(attrs) {
this.env = attrs.env;
this.id = attrs.id;
this.parentSuite = attrs.parentSuite;
Function pp
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().pp = function(j$) {
function PrettyPrinter() {
this.ppNestLevel_ = 0;
this.seen = [];
Function SpyRegistry
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().SpyRegistry = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<spyOn>', 'spyOn(<object>, <methodName>)');
function SpyRegistry(options) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Spec
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Spec = function(j$) {
function Spec(attrs) {
this.expectationFactory = attrs.expectationFactory;
this.resultCallback = attrs.resultCallback || function() {};
this.id = attrs.id;
Function DelayedFunctionScheduler
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().DelayedFunctionScheduler = function() {
function DelayedFunctionScheduler() {
var self = this;
var scheduledLookup = [];
var scheduledFunctions = {};
Function DelayedFunctionScheduler
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
function DelayedFunctionScheduler() {
var self = this;
var scheduledLookup = [];
var scheduledFunctions = {};
var currentTime = 0;
Function eq
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
function eq(a, b, aStack, bStack, customTesters) {
var result = true;
var asymmetricResult = asymmetricMatch(a, b);
if (!j$.util.isUndefined(asymmetricResult)) {
Function toThrowError
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().toThrowError = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toThrowError>', 'expect(function() {<expectation>}).toThrowError(<ErrorConstructor>, <message>)');
function toThrowError () {
Function toThrowError
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toThrowError () {
return {
compare: function(actual) {
var threw = false,
pass = {pass: true},
Function Clock
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Clock = function() {
function Clock(global, delayedFunctionSchedulerFactory, mockDate) {
var self = this,
realTimingFunctions = {
setTimeout: global.setTimeout,
Function Spec
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Spec = function(j$) {
function Spec(attrs) {
this.expectationFactory = attrs.expectationFactory;
this.resultCallback = attrs.resultCallback || function() {};
this.id = attrs.id;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Clock
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Clock(global, delayedFunctionSchedulerFactory, mockDate) {
var self = this,
realTimingFunctions = {
setTimeout: global.setTimeout,
clearTimeout: global.clearTimeout,
Function base
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().base = function(j$, jasmineGlobal) {
j$.unimplementedMethod_ = function() {
throw new Error('unimplemented method');
};
Function Clock
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Clock = function() {
function Clock(global, delayedFunctionSchedulerFactory, mockDate) {
var self = this,
realTimingFunctions = {
setTimeout: global.setTimeout,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Expectation
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Expectation = function() {
function Expectation(options) {
this.util = options.util || { buildFailureMessage: function() {} };
this.customEqualityTesters = options.customEqualityTesters || [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function QueueRunner
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().QueueRunner = function(j$) {
function once(fn) {
var called = false;
return function() {
Function QueueRunner
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().QueueRunner = function(j$) {
function once(fn) {
var called = false;
return function() {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Expectation
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Expectation = function() {
function Expectation(options) {
this.util = options.util || { buildFailureMessage: function() {} };
this.customEqualityTesters = options.customEqualityTesters || [];
Function base
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().base = function(j$, jasmineGlobal) {
j$.unimplementedMethod_ = function() {
throw new Error('unimplemented method');
};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function MockDate
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().MockDate = function() {
function MockDate(global) {
var self = this;
var currentTime = 0;
Function MockDate
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MockDate(global) {
var self = this;
var currentTime = 0;
if (!global || !global.Date) {
Function SpyRegistry
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().SpyRegistry = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<spyOn>', 'spyOn(<object>, <methodName>)');
function SpyRegistry(options) {
Function run
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
QueueRunner.prototype.run = function(queueableFns, recursiveIndex) {
var length = queueableFns.length,
self = this,
iterativeIndex;
Function interface
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().interface = function(jasmine, env) {
var jasmineInterface = {
describe: function(description, specDefinitions) {
return env.describe(description, specDefinitions);
},
Function JsApiReporter
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().JsApiReporter = function() {
var noopTimer = {
start: function(){},
elapsed: function(){ return 0; }
Function SpyRegistry
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SpyRegistry(options) {
options = options || {};
var currentSpies = options.currentSpies || function() { return []; };
this.allowRespy = function(allow){
Function CallTracker
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().CallTracker = function(j$) {
function CallTracker() {
var calls = [];
var opts = {};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function buildExpectationResult
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().buildExpectationResult = function() {
function buildExpectationResult(options) {
var messageFormatter = options.messageFormatter || function() {},
stackFormatter = options.stackFormatter || function() {};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getMatcher
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMatcher() {
var expected = null,
errorType = null;
if (arguments.length == 2) {
Function CallTracker
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().CallTracker = function(j$) {
function CallTracker() {
var calls = [];
var opts = {};
Function getJasmineRequireObj
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
var getJasmineRequireObj = (function (jasmineGlobal) {
var jasmineRequire;
if (typeof module !== 'undefined' && module.exports && typeof exports !== 'undefined') {
if (typeof global !== 'undefined') {
Function util
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().util = function() {
var util = {};
util.inherit = function(childClass, parentClass) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ObjectContaining
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().ObjectContaining = function(j$) {
function ObjectContaining(sample) {
this.sample = sample;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function toThrow
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().toThrow = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toThrow>', 'expect(function() {<expectation>}).toThrow()');
function toThrow(util) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function CallTracker
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CallTracker() {
var calls = [];
var opts = {};
function argCloner(context) {
Function JsApiReporter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function JsApiReporter(options) {
var timer = options.timer || noopTimer,
status = 'loaded';
this.started = false;
Function SpyStrategy
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().SpyStrategy = function(j$) {
function SpyStrategy(options) {
options = options || {};
Function util
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().util = function() {
var util = {};
util.inherit = function(childClass, parentClass) {
Function execute
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.execute = function(runnablesToRun) {
if(!runnablesToRun) {
if (focusedRunnables.length) {
runnablesToRun = focusedRunnables;
} else {
Function SpyStrategy
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SpyStrategy(options) {
options = options || {};
var identity = options.name || 'unknown',
originalFn = options.fn || function() {},
Function ExceptionFormatter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().ExceptionFormatter = function() {
function ExceptionFormatter() {
this.message = function(error) {
var message = '';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function MockDate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().MockDate = function() {
function MockDate(global) {
var self = this;
var currentTime = 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function spyOn
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.spyOn = function(obj, methodName) {
if (j$.util.isUndefined(obj)) {
throw new Error(getErrorMsg('could not find an object to spy upon for ' + methodName + '()'));
}
Function wrapCompare
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Expectation.prototype.wrapCompare = function(name, matcherFactory) {
return function() {
var args = Array.prototype.slice.call(arguments, 0),
expected = args.slice(0),
message = '';
Function format
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
PrettyPrinter.prototype.format = function(value) {
this.ppNestLevel_++;
try {
if (j$.util.isUndefined(value)) {
this.emitScalar('undefined');
Function buildExpectationResult
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().buildExpectationResult = function() {
function buildExpectationResult(options) {
var messageFormatter = options.messageFormatter || function() {},
stackFormatter = options.stackFormatter || function() {};
Function ReportDispatcher
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().ReportDispatcher = function() {
function ReportDispatcher(methods) {
var dispatchedMethods = methods || [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Any
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Any = function(j$) {
function Any(expectedObject) {
if (typeof expectedObject === 'undefined') {
throw new TypeError(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function compare
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
compare: function(actual) {
var threw = false,
pass = {pass: true},
fail = {pass: false},
thrown;
Function buildExpectationResult
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildExpectationResult(options) {
var messageFormatter = options.messageFormatter || function() {},
stackFormatter = options.stackFormatter || function() {};
var result = {
Function processNode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processNode(node, parentEnabled) {
var executableIndex = runnableIndex(node.id);
if (executableIndex !== undefined) {
parentEnabled = true;
Function toThrow
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().toThrow = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toThrow>', 'expect(function() {<expectation>}).toThrow()');
function toThrow(util) {
Function toHaveBeenCalledTimes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toHaveBeenCalledTimes>', 'expect(<spyObj>).toHaveBeenCalledTimes(<Number>)');
function toHaveBeenCalledTimes() {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ReportDispatcher
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().ReportDispatcher = function() {
function ReportDispatcher(methods) {
var dispatchedMethods = methods || [];
Function ObjectContaining
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().ObjectContaining = function(j$) {
function ObjectContaining(sample) {
this.sample = sample;
}
Function specFactory
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var specFactory = function(description, fn, suite, timeout) {
totalSpecsDefined++;
var spec = new j$.Spec({
id: getNextSpecId(),
beforeAndAfterFns: beforeAndAfterFns(suite),
Function core
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequire().core = function(jRequire) {
var j$ = {};
jRequire.base(j$, jasmineGlobal);
j$.util = jRequire.util();
Function ReportDispatcher
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ReportDispatcher(methods) {
var dispatchedMethods = methods || [];
for (var i = 0; i < dispatchedMethods.length; i++) {
Function toThrow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function toThrow(util) {
return {
compare: function(actual, expected) {
var result = { pass: false },
threw = false,
Function Any
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Any = function(j$) {
function Any(expectedObject) {
if (typeof expectedObject === 'undefined') {
throw new TypeError(
Function Order
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().Order = function() {
function Order(options) {
this.random = 'random' in options ? options.random : true;
var seed = this.seed = options.seed || generateSeed();
this.sort = this.random ? randomOrder : naturalOrder;
Function emitArray
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
StringPrettyPrinter.prototype.emitArray = function(array) {
if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
this.append('Array');
return;
}
Function Order
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Order(options) {
this.random = 'random' in options ? options.random : true;
var seed = this.seed = options.seed || generateSeed();
this.sort = this.random ? randomOrder : naturalOrder;
Function compare
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
compare: function(actual, expected) {
var result = { pass: false },
threw = false,
thrown;
Function requireMatchers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
var availableMatchers = [
'toBe',
'toBeCloseTo',
'toBeDefined',
Function getJasmineRequireObj
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var getJasmineRequireObj = (function (jasmineGlobal) {
var jasmineRequire;
if (typeof module !== 'undefined' && module.exports && typeof exports !== 'undefined') {
if (typeof global !== 'undefined') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function toHaveBeenCalledWith
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toHaveBeenCalledWith>', 'expect(<spyObj>).toHaveBeenCalledWith(...arguments)');
function toHaveBeenCalledWith(util, customEqualityTesters) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function scheduleFunction
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.scheduleFunction = function(funcToCall, millis, params, recurring, timeoutKey, runAtMillis) {
var f;
if (typeof(funcToCall) === 'string') {
/* jshint evil: true */
f = function() { return eval(funcToCall); };
Function toHaveBeenCalledWith
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toHaveBeenCalledWith>', 'expect(<spyObj>).toHaveBeenCalledWith(...arguments)');
function toHaveBeenCalledWith(util, customEqualityTesters) {
Function toHaveBeenCalled
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().toHaveBeenCalled = function(j$) {
var getErrorMsg = j$.formatErrorMsg('<toHaveBeenCalled>', 'expect(<spyObj>).toHaveBeenCalled()');
function toHaveBeenCalled() {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function scheduleFunction
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
self.scheduleFunction = function(funcToCall, millis, params, recurring, timeoutKey, runAtMillis) {
Function Order
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().Order = function() {
function Order(options) {
this.random = 'random' in options ? options.random : true;
var seed = this.seed = options.seed || generateSeed();
this.sort = this.random ? randomOrder : naturalOrder;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function eq
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function eq(a, b, aStack, bStack, customTesters) {
Function ArrayContaining
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().ArrayContaining = function(j$) {
function ArrayContaining(sample) {
this.sample = sample;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return other instanceof this.expectedObject;
Avoid too many return
statements within this function. Open
if (className != Object.prototype.toString.call(b)) { return false; }
Avoid too many return
statements within this function. Open
return a.isEqualNode(b);
Avoid too many return
statements within this function. Open
return a.outerHTML == b.outerHTML;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return fail;
Avoid too many return
statements within this function. Open
return result;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
if (aStack[length] == a) { return bStack[length] == b; }
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
if (keys(b, className == '[object Array]').length !== size) { return false; }
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
if (a === null || b === null) { return a === b; }
Avoid too many return
statements within this function. Open
return typeof other == 'boolean';
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return a.innerText == b.innerText && a.textContent == b.textContent;
Avoid too many return
statements within this function. Open
if (typeof a != 'object' || typeof b != 'object') { return false; }
Function SpyStrategy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getJasmineRequireObj().SpyStrategy = function(j$) {
function SpyStrategy(options) {
options = options || {};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"