|
|
|
|
@@ -153,43 +153,43 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
const availableMatchers = [
|
|
|
|
|
'nothing',
|
|
|
|
|
'toBe',
|
|
|
|
|
'toBeCloseTo',
|
|
|
|
|
'toBeDefined',
|
|
|
|
|
'toBeInstanceOf',
|
|
|
|
|
'toBeFalse',
|
|
|
|
|
'toBeFalsy',
|
|
|
|
|
'toBeGreaterThan',
|
|
|
|
|
'toBeGreaterThanOrEqual',
|
|
|
|
|
'toBeLessThan',
|
|
|
|
|
'toBeLessThanOrEqual',
|
|
|
|
|
'toBeNaN',
|
|
|
|
|
'toBeNegativeInfinity',
|
|
|
|
|
'toBeNull',
|
|
|
|
|
'toBePositiveInfinity',
|
|
|
|
|
'toBeTrue',
|
|
|
|
|
'toBeTruthy',
|
|
|
|
|
'toBeUndefined',
|
|
|
|
|
'toBeNullish',
|
|
|
|
|
'toContain',
|
|
|
|
|
'toEqual',
|
|
|
|
|
'toHaveSize',
|
|
|
|
|
'toHaveBeenCalled',
|
|
|
|
|
'toHaveBeenCalledBefore',
|
|
|
|
|
'toHaveBeenCalledOnceWith',
|
|
|
|
|
'toHaveBeenCalledTimes',
|
|
|
|
|
'toHaveBeenCalledWith',
|
|
|
|
|
'toHaveClass',
|
|
|
|
|
'toHaveClasses',
|
|
|
|
|
'toHaveSpyInteractions',
|
|
|
|
|
'toHaveNoOtherSpyInteractions',
|
|
|
|
|
'toMatch',
|
|
|
|
|
'toThrow',
|
|
|
|
|
'toThrowError',
|
|
|
|
|
'toThrowMatching'
|
|
|
|
|
],
|
|
|
|
|
matchers = {};
|
|
|
|
|
'nothing',
|
|
|
|
|
'toBe',
|
|
|
|
|
'toBeCloseTo',
|
|
|
|
|
'toBeDefined',
|
|
|
|
|
'toBeInstanceOf',
|
|
|
|
|
'toBeFalse',
|
|
|
|
|
'toBeFalsy',
|
|
|
|
|
'toBeGreaterThan',
|
|
|
|
|
'toBeGreaterThanOrEqual',
|
|
|
|
|
'toBeLessThan',
|
|
|
|
|
'toBeLessThanOrEqual',
|
|
|
|
|
'toBeNaN',
|
|
|
|
|
'toBeNegativeInfinity',
|
|
|
|
|
'toBeNull',
|
|
|
|
|
'toBePositiveInfinity',
|
|
|
|
|
'toBeTrue',
|
|
|
|
|
'toBeTruthy',
|
|
|
|
|
'toBeUndefined',
|
|
|
|
|
'toBeNullish',
|
|
|
|
|
'toContain',
|
|
|
|
|
'toEqual',
|
|
|
|
|
'toHaveSize',
|
|
|
|
|
'toHaveBeenCalled',
|
|
|
|
|
'toHaveBeenCalledBefore',
|
|
|
|
|
'toHaveBeenCalledOnceWith',
|
|
|
|
|
'toHaveBeenCalledTimes',
|
|
|
|
|
'toHaveBeenCalledWith',
|
|
|
|
|
'toHaveClass',
|
|
|
|
|
'toHaveClasses',
|
|
|
|
|
'toHaveSpyInteractions',
|
|
|
|
|
'toHaveNoOtherSpyInteractions',
|
|
|
|
|
'toMatch',
|
|
|
|
|
'toThrow',
|
|
|
|
|
'toThrowError',
|
|
|
|
|
'toThrowMatching'
|
|
|
|
|
];
|
|
|
|
|
const matchers = {};
|
|
|
|
|
|
|
|
|
|
for (const name of availableMatchers) {
|
|
|
|
|
matchers[name] = jRequire[name](j$);
|
|
|
|
|
@@ -733,8 +733,8 @@ getJasmineRequireObj().util = function(j$) {
|
|
|
|
|
|
|
|
|
|
util.cloneArgs = function(args) {
|
|
|
|
|
return Array.from(args).map(function(arg) {
|
|
|
|
|
const str = Object.prototype.toString.apply(arg),
|
|
|
|
|
primitives = /^\[object (Boolean|String|RegExp|Number)/;
|
|
|
|
|
const str = Object.prototype.toString.apply(arg);
|
|
|
|
|
const primitives = /^\[object (Boolean|String|RegExp|Number)/;
|
|
|
|
|
|
|
|
|
|
// All falsey values are either primitives, `null`, or `undefined.
|
|
|
|
|
if (!arg || str.match(primitives)) {
|
|
|
|
|
@@ -748,8 +748,8 @@ getJasmineRequireObj().util = function(j$) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
util.getPropertyDescriptor = function(obj, methodName) {
|
|
|
|
|
let descriptor,
|
|
|
|
|
proto = obj;
|
|
|
|
|
let descriptor;
|
|
|
|
|
let proto = obj;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
descriptor = Object.getOwnPropertyDescriptor(proto, methodName);
|
|
|
|
|
@@ -1175,10 +1175,12 @@ getJasmineRequireObj().Spec = function(j$) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const extractCustomPendingMessage = function(e) {
|
|
|
|
|
const fullMessage = e.toString(),
|
|
|
|
|
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
|
|
|
|
|
boilerplateEnd =
|
|
|
|
|
boilerplateStart + Spec.pendingSpecExceptionMessage.length;
|
|
|
|
|
const fullMessage = e.toString();
|
|
|
|
|
const boilerplateStart = fullMessage.indexOf(
|
|
|
|
|
Spec.pendingSpecExceptionMessage
|
|
|
|
|
);
|
|
|
|
|
const boilerplateEnd =
|
|
|
|
|
boilerplateStart + Spec.pendingSpecExceptionMessage.length;
|
|
|
|
|
|
|
|
|
|
return fullMessage.slice(boilerplateEnd);
|
|
|
|
|
};
|
|
|
|
|
@@ -2139,8 +2141,8 @@ getJasmineRequireObj().JsApiReporter = function(j$) {
|
|
|
|
|
return status;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const suites = [],
|
|
|
|
|
suites_hash = {};
|
|
|
|
|
const suites = [];
|
|
|
|
|
const suites_hash = {};
|
|
|
|
|
|
|
|
|
|
this.suiteStarted = function(result) {
|
|
|
|
|
suites_hash[result.id] = result;
|
|
|
|
|
@@ -5491,14 +5493,14 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MatchersUtil.prototype.buildFailureMessage = function() {
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0),
|
|
|
|
|
matcherName = args[0],
|
|
|
|
|
isNot = args[1],
|
|
|
|
|
actual = args[2],
|
|
|
|
|
expected = args.slice(3),
|
|
|
|
|
englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) {
|
|
|
|
|
return ' ' + s.toLowerCase();
|
|
|
|
|
});
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0);
|
|
|
|
|
const matcherName = args[0];
|
|
|
|
|
const isNot = args[1];
|
|
|
|
|
const actual = args[2];
|
|
|
|
|
const expected = args.slice(3);
|
|
|
|
|
const englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) {
|
|
|
|
|
return ' ' + s.toLowerCase();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let message =
|
|
|
|
|
'Expected ' +
|
|
|
|
|
@@ -5880,8 +5882,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|
|
|
|
} else {
|
|
|
|
|
// Objects with different constructors are not equivalent, but `Object`s
|
|
|
|
|
// or `Array`s from different frames are.
|
|
|
|
|
const aCtor = a.constructor,
|
|
|
|
|
bCtor = b.constructor;
|
|
|
|
|
const aCtor = a.constructor;
|
|
|
|
|
const bCtor = b.constructor;
|
|
|
|
|
if (
|
|
|
|
|
aCtor !== bCtor &&
|
|
|
|
|
isFunction(aCtor) &&
|
|
|
|
|
@@ -5987,11 +5989,11 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function objectKeysAreDifferentFormatter(pp, actual, expected, path) {
|
|
|
|
|
const missingProperties = extraKeysAndValues(expected, actual),
|
|
|
|
|
extraProperties = extraKeysAndValues(actual, expected),
|
|
|
|
|
missingPropertiesMessage = formatKeyValuePairs(pp, missingProperties),
|
|
|
|
|
extraPropertiesMessage = formatKeyValuePairs(pp, extraProperties),
|
|
|
|
|
messages = [];
|
|
|
|
|
const missingProperties = extraKeysAndValues(expected, actual);
|
|
|
|
|
const extraProperties = extraKeysAndValues(actual, expected);
|
|
|
|
|
const missingPropertiesMessage = formatKeyValuePairs(pp, missingProperties);
|
|
|
|
|
const extraPropertiesMessage = formatKeyValuePairs(pp, extraProperties);
|
|
|
|
|
const messages = [];
|
|
|
|
|
|
|
|
|
|
if (!path.depth()) {
|
|
|
|
|
path = 'object';
|
|
|
|
|
@@ -6249,15 +6251,15 @@ getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
const availableMatchers = [
|
|
|
|
|
'toBePending',
|
|
|
|
|
'toBeResolved',
|
|
|
|
|
'toBeRejected',
|
|
|
|
|
'toBeResolvedTo',
|
|
|
|
|
'toBeRejectedWith',
|
|
|
|
|
'toBeRejectedWithError',
|
|
|
|
|
'toBeRejectedWithMatching'
|
|
|
|
|
],
|
|
|
|
|
matchers = {};
|
|
|
|
|
'toBePending',
|
|
|
|
|
'toBeResolved',
|
|
|
|
|
'toBeRejected',
|
|
|
|
|
'toBeResolvedTo',
|
|
|
|
|
'toBeRejectedWith',
|
|
|
|
|
'toBeRejectedWithError',
|
|
|
|
|
'toBeRejectedWithMatching'
|
|
|
|
|
];
|
|
|
|
|
const matchers = {};
|
|
|
|
|
|
|
|
|
|
for (const name of availableMatchers) {
|
|
|
|
|
matchers[name] = jRequire[name](j$);
|
|
|
|
|
@@ -6863,11 +6865,11 @@ getJasmineRequireObj().toEqual = function(j$) {
|
|
|
|
|
return {
|
|
|
|
|
compare: function(actual, expected) {
|
|
|
|
|
const result = {
|
|
|
|
|
pass: false
|
|
|
|
|
},
|
|
|
|
|
diffBuilder = new j$.private.DiffBuilder({
|
|
|
|
|
prettyPrinter: matchersUtil.pp
|
|
|
|
|
});
|
|
|
|
|
pass: false
|
|
|
|
|
};
|
|
|
|
|
const diffBuilder = new j$.private.DiffBuilder({
|
|
|
|
|
prettyPrinter: matchersUtil.pp
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
result.pass = matchersUtil.equals(actual, expected, diffBuilder);
|
|
|
|
|
|
|
|
|
|
@@ -7052,9 +7054,9 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
|
|
|
|
|
function toHaveBeenCalledOnceWith(matchersUtil) {
|
|
|
|
|
return {
|
|
|
|
|
compare: function() {
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0),
|
|
|
|
|
actual = args[0],
|
|
|
|
|
expectedArgs = args.slice(1);
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0);
|
|
|
|
|
const actual = args[0];
|
|
|
|
|
const expectedArgs = args.slice(1);
|
|
|
|
|
|
|
|
|
|
if (!j$.isSpy(actual)) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
@@ -7171,8 +7173,8 @@ getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0),
|
|
|
|
|
result = { pass: false };
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0);
|
|
|
|
|
const result = { pass: false };
|
|
|
|
|
|
|
|
|
|
if (!j$.private.isNumber(expected)) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
@@ -7241,10 +7243,10 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
|
|
|
|
function toHaveBeenCalledWith(matchersUtil) {
|
|
|
|
|
return {
|
|
|
|
|
compare: function() {
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0),
|
|
|
|
|
actual = args[0],
|
|
|
|
|
expectedArgs = args.slice(1),
|
|
|
|
|
result = { pass: false };
|
|
|
|
|
const args = Array.prototype.slice.call(arguments, 0);
|
|
|
|
|
const actual = args[0];
|
|
|
|
|
const expectedArgs = args.slice(1);
|
|
|
|
|
const result = { pass: false };
|
|
|
|
|
|
|
|
|
|
if (!j$.isSpy(actual)) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
@@ -10133,22 +10135,22 @@ getJasmineRequireObj().Spy = function(j$) {
|
|
|
|
|
};
|
|
|
|
|
const { originalFn, customStrategies, defaultStrategyFn } = optionals || {};
|
|
|
|
|
|
|
|
|
|
const numArgs = typeof originalFn === 'function' ? originalFn.length : 0,
|
|
|
|
|
wrapper = makeFunc(numArgs, function(context, args, invokeNew) {
|
|
|
|
|
return spy(context, args, invokeNew);
|
|
|
|
|
}),
|
|
|
|
|
strategyDispatcher = new SpyStrategyDispatcher(
|
|
|
|
|
{
|
|
|
|
|
name: name,
|
|
|
|
|
fn: originalFn,
|
|
|
|
|
getSpy: function() {
|
|
|
|
|
return wrapper;
|
|
|
|
|
},
|
|
|
|
|
customStrategies: customStrategies
|
|
|
|
|
const numArgs = typeof originalFn === 'function' ? originalFn.length : 0;
|
|
|
|
|
const wrapper = makeFunc(numArgs, function(context, args, invokeNew) {
|
|
|
|
|
return spy(context, args, invokeNew);
|
|
|
|
|
});
|
|
|
|
|
const strategyDispatcher = new SpyStrategyDispatcher(
|
|
|
|
|
{
|
|
|
|
|
name: name,
|
|
|
|
|
fn: originalFn,
|
|
|
|
|
getSpy: function() {
|
|
|
|
|
return wrapper;
|
|
|
|
|
},
|
|
|
|
|
matchersUtil
|
|
|
|
|
),
|
|
|
|
|
callTracker = new j$.private.CallTracker();
|
|
|
|
|
customStrategies: customStrategies
|
|
|
|
|
},
|
|
|
|
|
matchersUtil
|
|
|
|
|
);
|
|
|
|
|
const callTracker = new j$.private.CallTracker();
|
|
|
|
|
|
|
|
|
|
function makeFunc(length, fn) {
|
|
|
|
|
switch (length) {
|
|
|
|
|
@@ -10595,10 +10597,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let pointer = obj,
|
|
|
|
|
propsToSpyOn = [],
|
|
|
|
|
properties,
|
|
|
|
|
propertiesToSkip = [];
|
|
|
|
|
let pointer = obj;
|
|
|
|
|
let propsToSpyOn = [];
|
|
|
|
|
let properties;
|
|
|
|
|
let propertiesToSkip = [];
|
|
|
|
|
|
|
|
|
|
while (
|
|
|
|
|
pointer &&
|
|
|
|
|
@@ -11882,9 +11884,9 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
|
|
|
|
|
|
|
|
|
function beforeAndAfterFns(targetSuite) {
|
|
|
|
|
return function() {
|
|
|
|
|
let befores = [],
|
|
|
|
|
afters = [],
|
|
|
|
|
suite = targetSuite;
|
|
|
|
|
let befores = [];
|
|
|
|
|
let afters = [];
|
|
|
|
|
let suite = targetSuite;
|
|
|
|
|
|
|
|
|
|
while (suite) {
|
|
|
|
|
befores = befores.concat(suite.beforeFns);
|
|
|
|
|
@@ -12095,15 +12097,15 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
|
|
|
|
|
|
|
|
|
|
function segmentChildren(node, orderedChildren, stats, executableIndex) {
|
|
|
|
|
let currentSegment = {
|
|
|
|
|
index: 0,
|
|
|
|
|
owner: node,
|
|
|
|
|
nodes: [],
|
|
|
|
|
min: startingMin(executableIndex),
|
|
|
|
|
max: startingMax(executableIndex)
|
|
|
|
|
},
|
|
|
|
|
result = [currentSegment],
|
|
|
|
|
lastMax = defaultMax,
|
|
|
|
|
orderedChildSegments = orderChildSegments(orderedChildren, stats);
|
|
|
|
|
index: 0,
|
|
|
|
|
owner: node,
|
|
|
|
|
nodes: [],
|
|
|
|
|
min: startingMin(executableIndex),
|
|
|
|
|
max: startingMax(executableIndex)
|
|
|
|
|
};
|
|
|
|
|
let result = [currentSegment];
|
|
|
|
|
let lastMax = defaultMax;
|
|
|
|
|
let orderedChildSegments = orderChildSegments(orderedChildren, stats);
|
|
|
|
|
|
|
|
|
|
function isSegmentBoundary(minIndex) {
|
|
|
|
|
return (
|
|
|
|
|
@@ -12114,9 +12116,9 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < orderedChildSegments.length; i++) {
|
|
|
|
|
const childSegment = orderedChildSegments[i],
|
|
|
|
|
maxIndex = childSegment.max,
|
|
|
|
|
minIndex = childSegment.min;
|
|
|
|
|
const childSegment = orderedChildSegments[i];
|
|
|
|
|
const maxIndex = childSegment.max;
|
|
|
|
|
const minIndex = childSegment.min;
|
|
|
|
|
|
|
|
|
|
if (isSegmentBoundary(minIndex)) {
|
|
|
|
|
currentSegment = {
|
|
|
|
|
@@ -12139,12 +12141,12 @@ getJasmineRequireObj().TreeProcessor = function(j$) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function orderChildSegments(children, stats) {
|
|
|
|
|
const specifiedOrder = [],
|
|
|
|
|
unspecifiedOrder = [];
|
|
|
|
|
const specifiedOrder = [];
|
|
|
|
|
const unspecifiedOrder = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < children.length; i++) {
|
|
|
|
|
const child = children[i],
|
|
|
|
|
segments = stats[child.id].segments;
|
|
|
|
|
const child = children[i];
|
|
|
|
|
const segments = stats[child.id].segments;
|
|
|
|
|
|
|
|
|
|
for (let j = 0; j < segments.length; j++) {
|
|
|
|
|
const seg = segments[j];
|
|
|
|
|
|