@@ -123,7 +123,9 @@ getJasmineRequireObj().CallTracker = function(j$) {
|
||||
* @param {Function} [argsCloner] A function to use to clone the arguments. Defaults to a shallow cloning function.
|
||||
* @function
|
||||
*/
|
||||
this.saveArgumentsByValue = function(argsCloner = j$.util.cloneArgs) {
|
||||
this.saveArgumentsByValue = function(
|
||||
argsCloner = j$.private.util.cloneArgs
|
||||
) {
|
||||
opts.cloneArgs = true;
|
||||
opts.argsCloner = argsCloner;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
|
||||
) {
|
||||
options = options || {};
|
||||
|
||||
if (!this.verbose_ && !j$.isError_(deprecation)) {
|
||||
if (!this.verbose_ && !j$.private.isError(deprecation)) {
|
||||
if (this.toSuppress_.indexOf(deprecation) !== -1) {
|
||||
return;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
|
||||
};
|
||||
|
||||
Deprecator.prototype.log_ = function(runnable, deprecation, options) {
|
||||
if (j$.isError_(deprecation)) {
|
||||
if (j$.private.isError(deprecation)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(deprecation);
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
|
||||
};
|
||||
|
||||
Deprecator.prototype.stackTrace_ = function() {
|
||||
const formatter = new j$.ExceptionFormatter();
|
||||
const formatter = new j$.private.ExceptionFormatter();
|
||||
return formatter.stack(new Error()).replace(/^Error\n/m, '');
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
|
||||
runnable = this.topSuite_;
|
||||
}
|
||||
|
||||
if (j$.isError_(deprecation)) {
|
||||
if (j$.private.isError(deprecation)) {
|
||||
runnable.addDeprecationWarning(deprecation);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,18 +11,18 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
envOptions = envOptions || {};
|
||||
|
||||
const self = this;
|
||||
const GlobalErrors = envOptions.GlobalErrors || j$.GlobalErrors;
|
||||
const GlobalErrors = envOptions.GlobalErrors || j$.private.GlobalErrors;
|
||||
const global = envOptions.global || j$.getGlobal();
|
||||
|
||||
const realSetTimeout = global.setTimeout;
|
||||
const realClearTimeout = global.clearTimeout;
|
||||
const clearStack = j$.getClearStack(global);
|
||||
this.clock = new j$.Clock(
|
||||
const clearStack = j$.private.getClearStack(global);
|
||||
this.clock = new j$.private.Clock(
|
||||
global,
|
||||
function() {
|
||||
return new j$.DelayedFunctionScheduler();
|
||||
return new j$.private.DelayedFunctionScheduler();
|
||||
},
|
||||
new j$.MockDate(global)
|
||||
new j$.private.MockDate(global)
|
||||
);
|
||||
|
||||
const globalErrors = new GlobalErrors(
|
||||
@@ -50,7 +50,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
})();
|
||||
|
||||
const runableResources = new j$.RunableResources({
|
||||
const runableResources = new j$.private.RunableResources({
|
||||
getCurrentRunableId: function() {
|
||||
const r = runner.currentRunable();
|
||||
return r ? r.id : null;
|
||||
@@ -63,7 +63,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
let runner;
|
||||
let parallelLoadingState = null; // 'specs', 'helpers', or null for non-parallel
|
||||
|
||||
const config = new j$.Configuration();
|
||||
const config = new j$.private.Configuration();
|
||||
|
||||
if (!envOptions.suppressLoadErrors) {
|
||||
installGlobalErrors();
|
||||
@@ -132,11 +132,11 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
runableResources.customObjectFormatters().push(formatter);
|
||||
};
|
||||
|
||||
j$.Expectation.addCoreMatchers(j$.matchers);
|
||||
j$.Expectation.addAsyncCoreMatchers(j$.asyncMatchers);
|
||||
j$.private.Expectation.addCoreMatchers(j$.private.matchers);
|
||||
j$.private.Expectation.addAsyncCoreMatchers(j$.private.asyncMatchers);
|
||||
|
||||
const expectationFactory = function(actual, spec) {
|
||||
return j$.Expectation.factory({
|
||||
return j$.private.Expectation.factory({
|
||||
matchersUtil: runableResources.makeMatchersUtil(),
|
||||
customMatchers: runableResources.customMatchers(),
|
||||
actual: actual,
|
||||
@@ -169,7 +169,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
const throwUnlessFactory = function(actual, spec) {
|
||||
return j$.Expectation.factory({
|
||||
return j$.private.Expectation.factory({
|
||||
matchersUtil: runableResources.makeMatchersUtil(),
|
||||
customMatchers: runableResources.customMatchers(),
|
||||
actual: actual,
|
||||
@@ -178,7 +178,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
const throwUnlessAsyncFactory = function(actual, spec) {
|
||||
return j$.Expectation.asyncFactory({
|
||||
return j$.private.Expectation.asyncFactory({
|
||||
matchersUtil: runableResources.makeMatchersUtil(),
|
||||
customAsyncMatchers: runableResources.customAsyncMatchers(),
|
||||
actual: actual,
|
||||
@@ -193,7 +193,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
error.matcherName !== undefined && error.passed !== undefined;
|
||||
const result = isExpectationResult
|
||||
? error
|
||||
: j$.buildExpectationResult({
|
||||
: j$.private.buildExpectationResult({
|
||||
error,
|
||||
passed: false,
|
||||
matcherName: '',
|
||||
@@ -254,7 +254,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
const asyncExpectationFactory = function(actual, spec, runableType) {
|
||||
return j$.Expectation.asyncFactory({
|
||||
return j$.private.Expectation.asyncFactory({
|
||||
matchersUtil: runableResources.makeMatchersUtil(),
|
||||
customAsyncMatchers: runableResources.customAsyncMatchers(),
|
||||
actual: actual,
|
||||
@@ -310,10 +310,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
(runner.currentRunable() || topSuite).handleException(e);
|
||||
};
|
||||
|
||||
new j$.QueueRunner(options).execute();
|
||||
new j$.private.QueueRunner(options).execute();
|
||||
}
|
||||
|
||||
const suiteBuilder = new j$.SuiteBuilder({
|
||||
const suiteBuilder = new j$.private.SuiteBuilder({
|
||||
env: this,
|
||||
expectationFactory,
|
||||
asyncExpectationFactory,
|
||||
@@ -321,7 +321,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
runQueue
|
||||
});
|
||||
topSuite = suiteBuilder.topSuite;
|
||||
const deprecator = new j$.Deprecator(topSuite);
|
||||
const deprecator = new j$.private.Deprecator(topSuite);
|
||||
|
||||
/**
|
||||
* Provides the root suite, through which all suites and specs can be
|
||||
@@ -341,23 +341,23 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
* @interface Reporter
|
||||
* @see custom_reporter
|
||||
*/
|
||||
reportDispatcher = new j$.ReportDispatcher(
|
||||
j$.reporterEvents,
|
||||
reportDispatcher = new j$.private.ReportDispatcher(
|
||||
j$.private.reporterEvents,
|
||||
function(options) {
|
||||
options.SkipPolicy = j$.NeverSkipPolicy;
|
||||
options.SkipPolicy = j$.private.NeverSkipPolicy;
|
||||
return runQueue(options);
|
||||
},
|
||||
recordLateError
|
||||
);
|
||||
|
||||
runner = new j$.Runner({
|
||||
runner = new j$.private.Runner({
|
||||
topSuite,
|
||||
totalSpecsDefined: () => suiteBuilder.totalSpecsDefined,
|
||||
focusedRunables: () => suiteBuilder.focusedRunables,
|
||||
runableResources,
|
||||
reportDispatcher,
|
||||
runQueue,
|
||||
TreeProcessor: j$.TreeProcessor,
|
||||
TreeProcessor: j$.private.TreeProcessor,
|
||||
globalErrors,
|
||||
getConfig: () => config
|
||||
});
|
||||
@@ -523,7 +523,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
try {
|
||||
const maybePromise = fn(spy);
|
||||
|
||||
if (!j$.isPromiseLike(maybePromise)) {
|
||||
if (!j$.private.isPromiseLike(maybePromise)) {
|
||||
throw new Error(
|
||||
'The callback to spyOnGlobalErrorsAsync must be an async or promise-returning function'
|
||||
);
|
||||
@@ -758,7 +758,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.pending = function(message) {
|
||||
let fullMessage = j$.Spec.pendingSpecExceptionMessage;
|
||||
let fullMessage = j$.private.Spec.pendingSpecExceptionMessage;
|
||||
if (message) {
|
||||
fullMessage += message;
|
||||
}
|
||||
@@ -777,7 +777,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
message += ': ';
|
||||
if (error.message) {
|
||||
message += error.message;
|
||||
} else if (j$.isString_(error)) {
|
||||
} else if (j$.private.isString(error)) {
|
||||
message += error;
|
||||
} else {
|
||||
// pretty print all kind of objects. This includes arrays.
|
||||
@@ -806,7 +806,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
}
|
||||
|
||||
function callerCallerFilename() {
|
||||
const frames = new j$.StackTrace(new Error()).frames;
|
||||
const frames = new j$.private.StackTrace(new Error()).frames;
|
||||
// frames[3] should always exist except in Jasmine's own tests, which bypass
|
||||
// the global it/describe layer, but don't crash if it doesn't.
|
||||
return frames[3] && frames[3].file;
|
||||
|
||||
@@ -14,7 +14,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
|
||||
|
||||
function ExceptionFormatter(options) {
|
||||
const jasmineFile =
|
||||
(options && options.jasmineFile) || j$.util.jasmineFile();
|
||||
(options && options.jasmineFile) || j$.private.util.jasmineFile();
|
||||
this.message = function(error) {
|
||||
let message = '';
|
||||
|
||||
@@ -58,7 +58,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
|
||||
lines.pop();
|
||||
}
|
||||
|
||||
const stackTrace = new j$.StackTrace(error);
|
||||
const stackTrace = new j$.private.StackTrace(error);
|
||||
lines = lines.concat(filterJasmine(stackTrace));
|
||||
|
||||
if (messageHandling === 'require') {
|
||||
@@ -111,7 +111,9 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
|
||||
}
|
||||
|
||||
if (!empty) {
|
||||
return 'error properties: ' + j$.basicPrettyPrinter_(result) + '\n';
|
||||
return (
|
||||
'error properties: ' + j$.private.basicPrettyPrinter(result) + '\n'
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
@@ -4,7 +4,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
* @namespace matchers
|
||||
*/
|
||||
function Expectation(options) {
|
||||
this.expector = new j$.Expector(options);
|
||||
this.expector = new j$.private.Expector(options);
|
||||
|
||||
const customMatchers = options.customMatchers || {};
|
||||
for (const matcherName in customMatchers) {
|
||||
@@ -80,7 +80,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
* @namespace async-matchers
|
||||
*/
|
||||
function AsyncExpectation(options) {
|
||||
this.expector = new j$.Expector(options);
|
||||
this.expector = new j$.private.Expector(options);
|
||||
|
||||
const customAsyncMatchers = options.customAsyncMatchers || {};
|
||||
for (const matcherName in customAsyncMatchers) {
|
||||
@@ -173,7 +173,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
|
||||
function negatedFailureMessage(result, matcherName, args, matchersUtil) {
|
||||
if (result.message) {
|
||||
if (j$.isFunction_(result.message)) {
|
||||
if (j$.private.isFunction(result.message)) {
|
||||
return result.message();
|
||||
} else {
|
||||
return result.message;
|
||||
@@ -218,7 +218,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
return function(actual) {
|
||||
const matcherArgs = arguments;
|
||||
|
||||
return j$.isPending_(actual).then(function(isPending) {
|
||||
return j$.private.isPending(actual).then(function(isPending) {
|
||||
if (isPending) {
|
||||
return {
|
||||
pass: false,
|
||||
|
||||
@@ -5,7 +5,7 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
};
|
||||
this.actual = options.actual;
|
||||
this.addExpectationResult = options.addExpectationResult || function() {};
|
||||
this.filters = new j$.ExpectationFilterChain();
|
||||
this.filters = new j$.private.ExpectationFilterChain();
|
||||
}
|
||||
|
||||
Expector.prototype.instantiateMatcher = function(
|
||||
@@ -39,7 +39,7 @@ getJasmineRequireObj().Expector = function(j$) {
|
||||
this.matchersUtil,
|
||||
args
|
||||
);
|
||||
} else if (j$.isFunction_(result.message)) {
|
||||
} else if (j$.private.isFunction(result.message)) {
|
||||
return result.message();
|
||||
} else {
|
||||
return result.message;
|
||||
|
||||
@@ -24,7 +24,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
if (
|
||||
global.process &&
|
||||
global.process.listeners &&
|
||||
j$.isFunction_(global.process.on)
|
||||
j$.private.isFunction(global.process.on)
|
||||
) {
|
||||
this.#adapter = new NodeAdapter(global, dispatch);
|
||||
} else {
|
||||
@@ -173,7 +173,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
const jasmineMessage = 'Unhandled promise rejection: ' + event.reason;
|
||||
let reason;
|
||||
|
||||
if (j$.isError_(event.reason)) {
|
||||
if (j$.private.isError(event.reason)) {
|
||||
reason = event.reason;
|
||||
reason.jasmineMessage = jasmineMessage;
|
||||
} else {
|
||||
@@ -252,7 +252,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
jasmineMessagePrefix = 'Uncaught exception';
|
||||
}
|
||||
|
||||
if (j$.isError_(error)) {
|
||||
if (j$.private.isError(error)) {
|
||||
error.jasmineMessage = jasmineMessagePrefix + ': ' + error;
|
||||
return error;
|
||||
} else {
|
||||
|
||||
@@ -16,11 +16,12 @@ getJasmineRequireObj().ParallelReportDispatcher = function(j$) {
|
||||
* @param onError {function} Function called when an unhandled exception, unhandled promise rejection, or explicit reporter failure occurs
|
||||
*/
|
||||
function ParallelReportDispatcher(onError, deps = {}) {
|
||||
const ReportDispatcher = deps.ReportDispatcher || j$.ReportDispatcher;
|
||||
const QueueRunner = deps.QueueRunner || j$.QueueRunner;
|
||||
const globalErrors = deps.globalErrors || new j$.GlobalErrors();
|
||||
const ReportDispatcher =
|
||||
deps.ReportDispatcher || j$.private.ReportDispatcher;
|
||||
const QueueRunner = deps.QueueRunner || j$.private.QueueRunner;
|
||||
const globalErrors = deps.globalErrors || new j$.private.GlobalErrors();
|
||||
const dispatcher = new ReportDispatcher(
|
||||
j$.reporterEvents,
|
||||
j$.private.reporterEvents,
|
||||
function(queueRunnerOptions) {
|
||||
queueRunnerOptions = {
|
||||
...queueRunnerOptions,
|
||||
@@ -84,7 +85,7 @@ getJasmineRequireObj().ParallelReportDispatcher = function(j$) {
|
||||
}
|
||||
};
|
||||
|
||||
for (const eventName of j$.reporterEvents) {
|
||||
for (const eventName of j$.private.reporterEvents) {
|
||||
self[eventName] = dispatcher[eventName].bind(dispatcher);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
this.emitScalar('<global>');
|
||||
} else if (value.jasmineToString) {
|
||||
this.emitScalar(value.jasmineToString(this.pp_));
|
||||
} else if (j$.isString_(value)) {
|
||||
} else if (j$.private.isString(value)) {
|
||||
this.emitString(value);
|
||||
} else if (j$.isSpy(value)) {
|
||||
this.emitScalar('spy on ' + value.and.identity);
|
||||
@@ -40,7 +40,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
} else {
|
||||
this.emitScalar('Function');
|
||||
}
|
||||
} else if (j$.isDomNode(value)) {
|
||||
} else if (j$.private.isDomNode(value)) {
|
||||
if (value.tagName) {
|
||||
this.emitDomElement(value);
|
||||
} else {
|
||||
@@ -48,16 +48,16 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
}
|
||||
} else if (value instanceof Date) {
|
||||
this.emitScalar('Date(' + value + ')');
|
||||
} else if (j$.isSet(value)) {
|
||||
} else if (j$.private.isSet(value)) {
|
||||
this.emitSet(value);
|
||||
} else if (j$.isMap(value)) {
|
||||
} else if (j$.private.isMap(value)) {
|
||||
this.emitMap(value);
|
||||
} else if (j$.isTypedArray_(value)) {
|
||||
} else if (j$.private.isTypedArray(value)) {
|
||||
this.emitTypedArray(value);
|
||||
} else if (
|
||||
value.toString &&
|
||||
typeof value === 'object' &&
|
||||
!j$.isArray_(value) &&
|
||||
!j$.private.isArray(value) &&
|
||||
hasCustomToString(value)
|
||||
) {
|
||||
try {
|
||||
@@ -69,12 +69,15 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
} else if (this.seen.includes(value)) {
|
||||
this.emitScalar(
|
||||
'<circular reference: ' +
|
||||
(j$.isArray_(value) ? 'Array' : 'Object') +
|
||||
(j$.private.isArray(value) ? 'Array' : 'Object') +
|
||||
'>'
|
||||
);
|
||||
} else if (j$.isArray_(value) || j$.isA_('Object', value)) {
|
||||
} else if (
|
||||
j$.private.isArray(value) ||
|
||||
j$.private.isA('Object', value)
|
||||
) {
|
||||
this.seen.push(value);
|
||||
if (j$.isArray_(value)) {
|
||||
if (j$.private.isArray(value)) {
|
||||
this.emitArray(value);
|
||||
} else {
|
||||
this.emitObject(value);
|
||||
@@ -97,7 +100,10 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
}
|
||||
|
||||
iterateObject(obj, fn) {
|
||||
const objKeys = j$.MatchersUtil.keys(obj, j$.isArray_(obj));
|
||||
const objKeys = j$.private.MatchersUtil.keys(
|
||||
obj,
|
||||
j$.private.isArray(obj)
|
||||
);
|
||||
const length = Math.min(objKeys.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
@@ -206,7 +212,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
const ctor = obj.constructor;
|
||||
const constructorName =
|
||||
typeof ctor === 'function' && obj instanceof ctor
|
||||
? j$.fnNameFor(obj.constructor)
|
||||
? j$.private.fnNameFor(obj.constructor)
|
||||
: 'null';
|
||||
|
||||
this.append(constructorName);
|
||||
@@ -236,7 +242,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
}
|
||||
|
||||
emitTypedArray(arr) {
|
||||
const constructorName = j$.fnNameFor(arr.constructor);
|
||||
const constructorName = j$.private.fnNameFor(arr.constructor);
|
||||
const limitedArray = Array.prototype.slice.call(
|
||||
arr,
|
||||
0,
|
||||
@@ -305,7 +311,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
|
||||
// iframe, web worker)
|
||||
try {
|
||||
return (
|
||||
j$.isFunction_(value.toString) &&
|
||||
j$.private.isFunction(value.toString) &&
|
||||
value.toString !== Object.prototype.toString &&
|
||||
value.toString() !== Object.prototype.toString.call(value)
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
|
||||
function StopExecutionError() {}
|
||||
StopExecutionError.prototype = new Error();
|
||||
j$.StopExecutionError = StopExecutionError;
|
||||
j$.private.StopExecutionError = StopExecutionError;
|
||||
|
||||
function once(fn, onTwice) {
|
||||
let called = false;
|
||||
@@ -56,7 +56,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
};
|
||||
this.onException = attrs.onException || emptyFn;
|
||||
this.onMultipleDone = attrs.onMultipleDone || fallbackOnMultipleDone;
|
||||
this.userContext = attrs.userContext || new j$.UserContext();
|
||||
this.userContext = attrs.userContext || new j$.private.UserContext();
|
||||
this.timeout = attrs.timeout || {
|
||||
setTimeout: setTimeout,
|
||||
clearTimeout: clearTimeout
|
||||
@@ -67,7 +67,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
popListener: emptyFn
|
||||
};
|
||||
|
||||
const SkipPolicy = attrs.SkipPolicy || j$.NeverSkipPolicy;
|
||||
const SkipPolicy = attrs.SkipPolicy || j$.private.NeverSkipPolicy;
|
||||
this.skipPolicy_ = new SkipPolicy(this.queueableFns);
|
||||
this.errored_ = false;
|
||||
|
||||
@@ -190,7 +190,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
if (queueableFn.fn.length === 0) {
|
||||
maybeThenable = queueableFn.fn.call(this.userContext);
|
||||
|
||||
if (maybeThenable && j$.isFunction_(maybeThenable.then)) {
|
||||
if (maybeThenable && j$.private.isFunction(maybeThenable.then)) {
|
||||
maybeThenable.then(
|
||||
wrapInPromiseResolutionHandler(next),
|
||||
onPromiseRejection
|
||||
@@ -260,11 +260,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
};
|
||||
|
||||
QueueRunner.prototype.diagnoseConflictingAsync_ = function(fn, retval) {
|
||||
if (retval && j$.isFunction_(retval.then)) {
|
||||
if (retval && j$.private.isFunction(retval.then)) {
|
||||
// Issue a warning that matches the user's code.
|
||||
// Omit the stack trace because there's almost certainly no user code
|
||||
// on the stack at this point.
|
||||
if (j$.isAsyncFunction_(fn)) {
|
||||
if (j$.private.isAsyncFunction(fn)) {
|
||||
this.onException(
|
||||
new Error(
|
||||
'An asynchronous before/it/after ' +
|
||||
@@ -288,7 +288,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
|
||||
function wrapInPromiseResolutionHandler(fn) {
|
||||
return function(maybeArg) {
|
||||
if (j$.isError_(maybeArg)) {
|
||||
if (j$.private.isError(maybeArg)) {
|
||||
fn(maybeArg);
|
||||
} else {
|
||||
fn();
|
||||
|
||||
@@ -5,7 +5,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
|
||||
this.getCurrentRunableId_ = options.getCurrentRunableId;
|
||||
this.globalErrors_ = options.globalErrors;
|
||||
|
||||
this.spyFactory = new j$.SpyFactory(
|
||||
this.spyFactory = new j$.private.SpyFactory(
|
||||
() => {
|
||||
if (this.getCurrentRunableId_()) {
|
||||
return this.customSpyStrategies();
|
||||
@@ -17,7 +17,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
|
||||
() => this.makeMatchersUtil()
|
||||
);
|
||||
|
||||
this.spyRegistry = new j$.SpyRegistry({
|
||||
this.spyRegistry = new j$.private.SpyRegistry({
|
||||
currentSpies: () => this.spies(),
|
||||
createSpy: (name, originalFn) =>
|
||||
this.spyFactory.createSpy(name, originalFn)
|
||||
@@ -48,7 +48,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
|
||||
];
|
||||
|
||||
for (const k of toClone) {
|
||||
newRes[k] = j$.util.clone(parentRes[k]);
|
||||
newRes[k] = j$.private.util.clone(parentRes[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,17 +126,19 @@ getJasmineRequireObj().RunableResources = function(j$) {
|
||||
}
|
||||
|
||||
makePrettyPrinter() {
|
||||
return j$.makePrettyPrinter(this.customObjectFormatters());
|
||||
return j$.private.makePrettyPrinter(this.customObjectFormatters());
|
||||
}
|
||||
|
||||
makeMatchersUtil() {
|
||||
if (this.getCurrentRunableId_()) {
|
||||
return new j$.MatchersUtil({
|
||||
return new j$.private.MatchersUtil({
|
||||
customTesters: this.customEqualityTesters(),
|
||||
pp: this.makePrettyPrinter()
|
||||
});
|
||||
} else {
|
||||
return new j$.MatchersUtil({ pp: j$.basicPrettyPrinter_ });
|
||||
return new j$.private.MatchersUtil({
|
||||
pp: j$.private.basicPrettyPrinter
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
this.#reportDispatcher = options.reportDispatcher;
|
||||
this.#getConfig = options.getConfig;
|
||||
this.#executedBefore = false;
|
||||
this.#currentRunableTracker = new j$.CurrentRunableTracker();
|
||||
this.#currentRunableTracker = new j$.private.CurrentRunableTracker();
|
||||
}
|
||||
|
||||
currentSpec() {
|
||||
@@ -64,9 +64,9 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
}
|
||||
}
|
||||
|
||||
const order = new j$.Order({
|
||||
const order = new j$.private.Order({
|
||||
random: config.random,
|
||||
seed: j$.isNumber_(config.seed) ? config.seed + '' : config.seed
|
||||
seed: j$.private.isNumber(config.seed) ? config.seed + '' : config.seed
|
||||
});
|
||||
|
||||
const treeProcessor = new this.#TreeProcessor({
|
||||
@@ -108,7 +108,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
||||
});
|
||||
|
||||
this.#currentRunableTracker.pushSuite(this.#topSuite);
|
||||
const treeRunner = new j$.TreeRunner({
|
||||
const treeRunner = new j$.private.TreeRunner({
|
||||
executionTree: this.#executionTree,
|
||||
globalErrors: this.#globalErrors,
|
||||
runableResources: this.#runableResources,
|
||||
|
||||
@@ -43,7 +43,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
}
|
||||
|
||||
addExpectationResult(passed, data, isError) {
|
||||
const expectationResult = j$.buildExpectationResult(data);
|
||||
const expectationResult = j$.private.buildExpectationResult(data);
|
||||
|
||||
if (passed) {
|
||||
this.result.passedExpectations.push(expectationResult);
|
||||
@@ -60,7 +60,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
}
|
||||
|
||||
if (this.#throwOnExpectationFailure && !isError) {
|
||||
throw new j$.errors.ExpectationFailed();
|
||||
throw new j$.private.errors.ExpectationFailed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,8 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
// Key and value will eventually be cloned during reporting. The error
|
||||
// thrown at that point if they aren't cloneable isn't very helpful.
|
||||
// Throw a better one now.
|
||||
j$.util.assertStructuredCloneable(key, 'Key');
|
||||
j$.util.assertStructuredCloneable(value, 'Value');
|
||||
j$.private.util.assertStructuredCloneable(key, 'Key');
|
||||
j$.private.util.assertStructuredCloneable(value, 'Value');
|
||||
this.result.properties = this.result.properties || {};
|
||||
this.result.properties[key] = value;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e instanceof j$.errors.ExpectationFailed) {
|
||||
if (e instanceof j$.private.errors.ExpectationFailed) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ getJasmineRequireObj().Spec = function(j$) {
|
||||
deprecation = { message: deprecation };
|
||||
}
|
||||
this.result.deprecationWarnings.push(
|
||||
j$.buildExpectationResult(deprecation)
|
||||
j$.private.buildExpectationResult(deprecation)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ getJasmineRequireObj().Spy = function(j$) {
|
||||
},
|
||||
matchersUtil
|
||||
),
|
||||
callTracker = new j$.CallTracker();
|
||||
callTracker = new j$.private.CallTracker();
|
||||
|
||||
function makeFunc(length, fn) {
|
||||
switch (length) {
|
||||
@@ -145,9 +145,9 @@ getJasmineRequireObj().Spy = function(j$) {
|
||||
}
|
||||
|
||||
function SpyStrategyDispatcher(strategyArgs, matchersUtil) {
|
||||
const baseStrategy = new j$.SpyStrategy(strategyArgs);
|
||||
const baseStrategy = new j$.private.SpyStrategy(strategyArgs);
|
||||
const argsStrategies = new StrategyDict(function() {
|
||||
return new j$.SpyStrategy(strategyArgs);
|
||||
return new j$.private.SpyStrategy(strategyArgs);
|
||||
}, matchersUtil);
|
||||
|
||||
this.and = baseStrategy;
|
||||
|
||||
@@ -5,12 +5,12 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
getMatchersUtil
|
||||
) {
|
||||
this.createSpy = function(name, originalFn) {
|
||||
if (j$.isFunction_(name) && originalFn === undefined) {
|
||||
if (j$.private.isFunction(name) && originalFn === undefined) {
|
||||
originalFn = name;
|
||||
name = originalFn.name;
|
||||
}
|
||||
|
||||
return j$.Spy(name, getMatchersUtil(), {
|
||||
return j$.private.Spy(name, getMatchersUtil(), {
|
||||
originalFn,
|
||||
customStrategies: getCustomStrategies(),
|
||||
defaultStrategyFn: getDefaultStrategyFn()
|
||||
@@ -19,7 +19,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
|
||||
this.createSpyObj = function(baseName, methodNames, propertyNames) {
|
||||
const baseNameIsCollection =
|
||||
j$.isObject_(baseName) || j$.isArray_(baseName);
|
||||
j$.private.isObject(baseName) || j$.private.isArray(baseName);
|
||||
|
||||
if (baseNameIsCollection) {
|
||||
propertyNames = methodNames;
|
||||
@@ -65,11 +65,11 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
|
||||
function normalizeKeyValues(object) {
|
||||
const result = [];
|
||||
if (j$.isArray_(object)) {
|
||||
if (j$.private.isArray(object)) {
|
||||
for (let i = 0; i < object.length; i++) {
|
||||
result.push([object[i]]);
|
||||
}
|
||||
} else if (j$.isObject_(object)) {
|
||||
} else if (j$.private.isObject(object)) {
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
result.push([key, object[key]]);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
const spyOnMsg = j$.formatErrorMsg(
|
||||
const spyOnMsg = j$.private.formatErrorMsg(
|
||||
'<spyOn>',
|
||||
'spyOn(<object>, <methodName>)'
|
||||
);
|
||||
const spyOnPropertyMsg = j$.formatErrorMsg(
|
||||
const spyOnPropertyMsg = j$.private.formatErrorMsg(
|
||||
'<spyOnProperty>',
|
||||
'spyOnProperty(<object>, <propName>, [accessType])'
|
||||
);
|
||||
@@ -43,7 +43,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
|
||||
// Spying on mock clock timing fns would prevent the real ones from being
|
||||
// restored.
|
||||
if (obj[methodName] && obj[methodName][j$.Clock.IsMockClockTimingFn]) {
|
||||
if (
|
||||
obj[methodName] &&
|
||||
obj[methodName][j$.private.Clock.IsMockClockTimingFn]
|
||||
) {
|
||||
throw new Error("Mock clock timing functions can't be spied on");
|
||||
}
|
||||
|
||||
@@ -94,7 +97,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
// localStorage in Firefox and later Safari versions, have no-op setters.
|
||||
if (obj[methodName] !== spiedMethod) {
|
||||
throw new Error(
|
||||
j$.formatErrorMsg('<spyOn>')(
|
||||
j$.private.formatErrorMsg('<spyOn>')(
|
||||
`Can't spy on ${methodName} because assigning to it had no effect`
|
||||
)
|
||||
);
|
||||
@@ -122,7 +125,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
throw new Error(getErrorMsg('No property name supplied'));
|
||||
}
|
||||
|
||||
const descriptor = j$.util.getPropertyDescriptor(obj, propertyName);
|
||||
const descriptor = j$.private.util.getPropertyDescriptor(
|
||||
obj,
|
||||
propertyName
|
||||
);
|
||||
|
||||
if (!descriptor) {
|
||||
throw new Error(getErrorMsg(propertyName + ' property does not exist'));
|
||||
@@ -157,7 +163,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||
}
|
||||
}
|
||||
|
||||
const originalDescriptor = j$.util.clone(descriptor);
|
||||
const originalDescriptor = j$.private.util.clone(descriptor);
|
||||
const spy = createSpy(propertyName, descriptor[accessType]);
|
||||
let restoreStrategy;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
|
||||
const cs = options.customStrategies || {};
|
||||
for (const k in cs) {
|
||||
if (j$.util.has(cs, k) && !this[k]) {
|
||||
if (j$.private.util.has(cs, k) && !this[k]) {
|
||||
this[k] = createCustomPlan(cs[k]);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
return function() {
|
||||
const plan = factory.apply(null, arguments);
|
||||
|
||||
if (!j$.isFunction_(plan)) {
|
||||
if (!j$.private.isFunction(plan)) {
|
||||
throw new Error('Spy strategy must return a function');
|
||||
}
|
||||
|
||||
@@ -129,7 +129,9 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
* @param {Error|Object|String} something Thing to throw
|
||||
*/
|
||||
SpyStrategy.prototype.throwError = function(something) {
|
||||
const error = j$.isString_(something) ? new Error(something) : something;
|
||||
const error = j$.private.isString(something)
|
||||
? new Error(something)
|
||||
: something;
|
||||
this.plan = function() {
|
||||
throw error;
|
||||
};
|
||||
@@ -146,9 +148,9 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
|
||||
SpyStrategy.prototype.callFake = function(fn) {
|
||||
if (
|
||||
!(
|
||||
j$.isFunction_(fn) ||
|
||||
j$.isAsyncFunction_(fn) ||
|
||||
j$.isGeneratorFunction_(fn)
|
||||
j$.private.isFunction(fn) ||
|
||||
j$.private.isAsyncFunction(fn) ||
|
||||
j$.private.isGeneratorFunction(fn)
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
|
||||
@@ -34,8 +34,8 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
// Key and value will eventually be cloned during reporting. The error
|
||||
// thrown at that point if they aren't cloneable isn't very helpful.
|
||||
// Throw a better one now.
|
||||
j$.util.assertStructuredCloneable(key, 'Key');
|
||||
j$.util.assertStructuredCloneable(value, 'Value');
|
||||
j$.private.util.assertStructuredCloneable(key, 'Key');
|
||||
j$.private.util.assertStructuredCloneable(value, 'Value');
|
||||
this.result.properties = this.result.properties || {};
|
||||
this.result.properties[key] = value;
|
||||
}
|
||||
@@ -170,18 +170,18 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
if (!this.sharedContext) {
|
||||
this.sharedContext = this.parentSuite
|
||||
? this.parentSuite.clonedSharedUserContext()
|
||||
: new j$.UserContext();
|
||||
: new j$.private.UserContext();
|
||||
}
|
||||
|
||||
return this.sharedContext;
|
||||
}
|
||||
|
||||
clonedSharedUserContext() {
|
||||
return j$.UserContext.fromExisting(this.sharedUserContext());
|
||||
return j$.private.UserContext.fromExisting(this.sharedUserContext());
|
||||
}
|
||||
|
||||
handleException() {
|
||||
if (arguments[0] instanceof j$.errors.ExpectationFailed) {
|
||||
if (arguments[0] instanceof j$.private.errors.ExpectationFailed) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
passed: false,
|
||||
error: arguments[0]
|
||||
};
|
||||
const failedExpectation = j$.buildExpectationResult(data);
|
||||
const failedExpectation = j$.private.buildExpectationResult(data);
|
||||
|
||||
if (!this.parentSuite) {
|
||||
failedExpectation.globalErrorType = 'afterAll';
|
||||
@@ -232,7 +232,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
return;
|
||||
}
|
||||
|
||||
const expectationResult = j$.buildExpectationResult(data);
|
||||
const expectationResult = j$.private.buildExpectationResult(data);
|
||||
|
||||
if (this.reportedDone) {
|
||||
this.onLateError(expectationResult);
|
||||
@@ -246,7 +246,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
}
|
||||
|
||||
if (this.#throwOnExpectationFailure) {
|
||||
throw new j$.errors.ExpectationFailed();
|
||||
throw new j$.private.errors.ExpectationFailed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ getJasmineRequireObj().Suite = function(j$) {
|
||||
deprecation = { message: deprecation };
|
||||
}
|
||||
this.result.deprecationWarnings.push(
|
||||
j$.buildExpectationResult(deprecation)
|
||||
j$.private.buildExpectationResult(deprecation)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
ensureIsFunctionOrAsync(fn, 'fit');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
j$.private.util.validateTimeout(timeout);
|
||||
}
|
||||
const spec = this.specFactory_(description, fn, timeout, filename);
|
||||
this.currentDeclarationSuite_.addChild(spec);
|
||||
@@ -105,7 +105,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
j$.private.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
this.currentDeclarationSuite_.beforeEach({
|
||||
@@ -118,7 +118,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
j$.private.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
this.currentDeclarationSuite_.beforeAll({
|
||||
@@ -131,7 +131,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
j$.private.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
afterEachFunction.isCleanup = true;
|
||||
@@ -145,7 +145,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
|
||||
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
j$.private.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
this.currentDeclarationSuite_.afterAll({
|
||||
@@ -156,7 +156,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
|
||||
it_(description, fn, timeout, filename) {
|
||||
if (timeout) {
|
||||
j$.util.validateTimeout(timeout);
|
||||
j$.private.util.validateTimeout(timeout);
|
||||
}
|
||||
|
||||
this.checkDuplicate_(description, 'spec');
|
||||
@@ -195,7 +195,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
const parentSuite = this.currentDeclarationSuite_;
|
||||
const reportedParentSuiteId =
|
||||
parentSuite === this.topSuite ? null : parentSuite.id;
|
||||
return new j$.Suite({
|
||||
return new j$.private.Suite({
|
||||
id: 'suite' + this.nextSuiteId_++,
|
||||
description,
|
||||
filename,
|
||||
@@ -237,7 +237,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
const config = this.env_.configuration();
|
||||
const suite = this.currentDeclarationSuite_;
|
||||
const parentSuiteId = suite === this.topSuite ? null : suite.id;
|
||||
const spec = new j$.Spec({
|
||||
const spec = new j$.private.Spec({
|
||||
id: 'spec' + this.nextSpecId_++,
|
||||
filename,
|
||||
parentSuiteId,
|
||||
@@ -300,17 +300,21 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
|
||||
}
|
||||
|
||||
function ensureIsFunction(fn, caller) {
|
||||
if (!j$.isFunction_(fn)) {
|
||||
if (!j$.private.isFunction(fn)) {
|
||||
throw new Error(
|
||||
caller + ' expects a function argument; received ' + j$.getType_(fn)
|
||||
caller +
|
||||
' expects a function argument; received ' +
|
||||
j$.private.getType(fn)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureIsFunctionOrAsync(fn, caller) {
|
||||
if (!j$.isFunction_(fn) && !j$.isAsyncFunction_(fn)) {
|
||||
if (!j$.private.isFunction(fn) && !j$.private.isAsyncFunction(fn)) {
|
||||
throw new Error(
|
||||
caller + ' expects a function argument; received ' + j$.getType_(fn)
|
||||
caller +
|
||||
' expects a function argument; received ' +
|
||||
j$.private.getType(fn)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,14 +78,14 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
},
|
||||
onComplete: () => {
|
||||
if (spec.result.status === 'failed') {
|
||||
specOverallDone(new j$.StopExecutionError('spec failed'));
|
||||
specOverallDone(new j$.private.StopExecutionError('spec failed'));
|
||||
} else {
|
||||
specOverallDone();
|
||||
}
|
||||
},
|
||||
userContext: spec.userContext(),
|
||||
runnableName: spec.getFullName.bind(spec),
|
||||
SkipPolicy: j$.CompleteOnFirstErrorSkipPolicy
|
||||
SkipPolicy: j$.private.CompleteOnFirstErrorSkipPolicy
|
||||
});
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
|
||||
async #reportChildrenOfBeforeAllFailure(suite) {
|
||||
for (const child of suite.children) {
|
||||
if (child instanceof j$.Suite) {
|
||||
if (child instanceof j$.private.Suite) {
|
||||
await this.#reportDispatcher.suiteStarted(child.result);
|
||||
await this.#reportChildrenOfBeforeAllFailure(child);
|
||||
|
||||
@@ -292,9 +292,9 @@ getJasmineRequireObj().TreeRunner = function(j$) {
|
||||
|
||||
#suiteSkipPolicy() {
|
||||
if (this.#getConfig().stopOnSpecFailure) {
|
||||
return j$.CompleteOnFirstErrorSkipPolicy;
|
||||
return j$.private.CompleteOnFirstErrorSkipPolicy;
|
||||
} else {
|
||||
return j$.SkipAfterBeforeAllErrorPolicy;
|
||||
return j$.private.SkipAfterBeforeAllErrorPolicy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ getJasmineRequireObj().Any = function(j$) {
|
||||
};
|
||||
|
||||
Any.prototype.jasmineToString = function() {
|
||||
return '<jasmine.any(' + j$.fnNameFor(this.expectedObject) + ')>';
|
||||
return '<jasmine.any(' + j$.private.fnNameFor(this.expectedObject) + ')>';
|
||||
};
|
||||
|
||||
return Any;
|
||||
|
||||
@@ -4,10 +4,10 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
}
|
||||
|
||||
ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.isArray_(this.sample)) {
|
||||
if (!j$.private.isArray(this.sample)) {
|
||||
throw new Error(
|
||||
'You must provide an array to arrayContaining, not ' +
|
||||
j$.basicPrettyPrinter_(this.sample) +
|
||||
j$.private.basicPrettyPrinter(this.sample) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
|
||||
// If the actual parameter is not an array, we can fail immediately, since it couldn't
|
||||
// possibly be an "array containing" anything. However, we also want an empty sample
|
||||
// array to match anything, so we need to double-check we aren't in that case
|
||||
if (!j$.isArray_(other) && this.sample.length > 0) {
|
||||
if (!j$.private.isArray(other) && this.sample.length > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
|
||||
other,
|
||||
matchersUtil
|
||||
) {
|
||||
if (!j$.isArray_(this.sample)) {
|
||||
if (!j$.private.isArray(this.sample)) {
|
||||
throw new Error(
|
||||
'You must provide an array to arrayWithExactContents, not ' +
|
||||
j$.basicPrettyPrinter_(this.sample) +
|
||||
j$.private.basicPrettyPrinter(this.sample) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,19 @@ getJasmineRequireObj().Empty = function(j$) {
|
||||
function Empty() {}
|
||||
|
||||
Empty.prototype.asymmetricMatch = function(other) {
|
||||
if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
|
||||
if (
|
||||
j$.private.isString(other) ||
|
||||
j$.private.isArray(other) ||
|
||||
j$.private.isTypedArray(other)
|
||||
) {
|
||||
return other.length === 0;
|
||||
}
|
||||
|
||||
if (j$.isMap(other) || j$.isSet(other)) {
|
||||
if (j$.private.isMap(other) || j$.private.isSet(other)) {
|
||||
return other.size === 0;
|
||||
}
|
||||
|
||||
if (j$.isObject_(other)) {
|
||||
if (j$.private.isObject(other)) {
|
||||
return Object.keys(other).length === 0;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
getJasmineRequireObj().MapContaining = function(j$) {
|
||||
function MapContaining(sample) {
|
||||
if (!j$.isMap(sample)) {
|
||||
if (!j$.private.isMap(sample)) {
|
||||
throw new Error(
|
||||
'You must provide a map to `mapContaining`, not ' +
|
||||
j$.basicPrettyPrinter_(sample)
|
||||
j$.private.basicPrettyPrinter(sample)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ getJasmineRequireObj().MapContaining = function(j$) {
|
||||
}
|
||||
|
||||
MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.isMap(other)) {
|
||||
if (!j$.private.isMap(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,19 @@ getJasmineRequireObj().NotEmpty = function(j$) {
|
||||
function NotEmpty() {}
|
||||
|
||||
NotEmpty.prototype.asymmetricMatch = function(other) {
|
||||
if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) {
|
||||
if (
|
||||
j$.private.isString(other) ||
|
||||
j$.private.isArray(other) ||
|
||||
j$.private.isTypedArray(other)
|
||||
) {
|
||||
return other.length !== 0;
|
||||
}
|
||||
|
||||
if (j$.isMap(other) || j$.isSet(other)) {
|
||||
if (j$.private.isMap(other) || j$.private.isSet(other)) {
|
||||
return other.size !== 0;
|
||||
}
|
||||
|
||||
if (j$.isObject_(other)) {
|
||||
if (j$.private.isObject(other)) {
|
||||
return Object.keys(other).length !== 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
};
|
||||
|
||||
ObjectContaining.prototype.valuesForDiff_ = function(other, pp) {
|
||||
if (!j$.isObject_(other)) {
|
||||
if (!j$.private.isObject(other)) {
|
||||
return {
|
||||
self: this.jasmineToString(pp),
|
||||
other: other
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
getJasmineRequireObj().SetContaining = function(j$) {
|
||||
function SetContaining(sample) {
|
||||
if (!j$.isSet(sample)) {
|
||||
if (!j$.private.isSet(sample)) {
|
||||
throw new Error(
|
||||
'You must provide a set to `setContaining`, not ' +
|
||||
j$.basicPrettyPrinter_(sample)
|
||||
j$.private.basicPrettyPrinter(sample)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ getJasmineRequireObj().SetContaining = function(j$) {
|
||||
}
|
||||
|
||||
SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.isSet(other)) {
|
||||
if (!j$.private.isSet(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
getJasmineRequireObj().StringContaining = function(j$) {
|
||||
function StringContaining(expected) {
|
||||
if (!j$.isString_(expected)) {
|
||||
if (!j$.private.isString(expected)) {
|
||||
throw new Error('Expected is not a String');
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ getJasmineRequireObj().StringContaining = function(j$) {
|
||||
}
|
||||
|
||||
StringContaining.prototype.asymmetricMatch = function(other) {
|
||||
if (!j$.isString_(other)) {
|
||||
if (!j$.private.isString(other)) {
|
||||
// Arrays, etc. don't match no matter what their indexOf returns.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
getJasmineRequireObj().StringMatching = function(j$) {
|
||||
function StringMatching(expected) {
|
||||
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
|
||||
if (!j$.private.isString(expected) && !j$.private.isA('RegExp', expected)) {
|
||||
throw new Error('Expected is not a String or a RegExp');
|
||||
}
|
||||
|
||||
|
||||
150
src/core/base.js
150
src/core/base.js
@@ -45,7 +45,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return DEFAULT_TIMEOUT_INTERVAL;
|
||||
},
|
||||
set: function(newValue) {
|
||||
j$.util.validateTimeout(newValue, 'jasmine.DEFAULT_TIMEOUT_INTERVAL');
|
||||
j$.private.util.validateTimeout(
|
||||
newValue,
|
||||
'jasmine.DEFAULT_TIMEOUT_INTERVAL'
|
||||
);
|
||||
DEFAULT_TIMEOUT_INTERVAL = newValue;
|
||||
}
|
||||
});
|
||||
@@ -63,58 +66,61 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @return {Env}
|
||||
*/
|
||||
j$.getEnv = function(options) {
|
||||
const env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options));
|
||||
const env = (j$.private.currentEnv_ =
|
||||
j$.private.currentEnv_ || new j$.private.Env(options));
|
||||
//jasmine. singletons in here (setTimeout blah blah).
|
||||
return env;
|
||||
};
|
||||
|
||||
j$.isArray_ = function(value) {
|
||||
return j$.isA_('Array', value);
|
||||
j$.private.isArray = function(value) {
|
||||
return j$.private.isA('Array', value);
|
||||
};
|
||||
|
||||
j$.isObject_ = function(value) {
|
||||
return value !== undefined && value !== null && j$.isA_('Object', value);
|
||||
};
|
||||
|
||||
j$.isString_ = function(value) {
|
||||
return j$.isA_('String', value);
|
||||
};
|
||||
|
||||
j$.isNumber_ = function(value) {
|
||||
return j$.isA_('Number', value);
|
||||
};
|
||||
|
||||
j$.isFunction_ = function(value) {
|
||||
return j$.isA_('Function', value);
|
||||
};
|
||||
|
||||
j$.isAsyncFunction_ = function(value) {
|
||||
return j$.isA_('AsyncFunction', value);
|
||||
};
|
||||
|
||||
j$.isGeneratorFunction_ = function(value) {
|
||||
return j$.isA_('GeneratorFunction', value);
|
||||
};
|
||||
|
||||
j$.isTypedArray_ = function(value) {
|
||||
j$.private.isObject = function(value) {
|
||||
return (
|
||||
j$.isA_('Float32Array', value) ||
|
||||
j$.isA_('Float64Array', value) ||
|
||||
j$.isA_('Int16Array', value) ||
|
||||
j$.isA_('Int32Array', value) ||
|
||||
j$.isA_('Int8Array', value) ||
|
||||
j$.isA_('Uint16Array', value) ||
|
||||
j$.isA_('Uint32Array', value) ||
|
||||
j$.isA_('Uint8Array', value) ||
|
||||
j$.isA_('Uint8ClampedArray', value)
|
||||
value !== undefined && value !== null && j$.private.isA('Object', value)
|
||||
);
|
||||
};
|
||||
|
||||
j$.isA_ = function(typeName, value) {
|
||||
return j$.getType_(value) === '[object ' + typeName + ']';
|
||||
j$.private.isString = function(value) {
|
||||
return j$.private.isA('String', value);
|
||||
};
|
||||
|
||||
j$.isError_ = function(value) {
|
||||
j$.private.isNumber = function(value) {
|
||||
return j$.private.isA('Number', value);
|
||||
};
|
||||
|
||||
j$.private.isFunction = function(value) {
|
||||
return j$.private.isA('Function', value);
|
||||
};
|
||||
|
||||
j$.private.isAsyncFunction = function(value) {
|
||||
return j$.private.isA('AsyncFunction', value);
|
||||
};
|
||||
|
||||
j$.private.isGeneratorFunction = function(value) {
|
||||
return j$.private.isA('GeneratorFunction', value);
|
||||
};
|
||||
|
||||
j$.private.isTypedArray = function(value) {
|
||||
return (
|
||||
j$.private.isA('Float32Array', value) ||
|
||||
j$.private.isA('Float64Array', value) ||
|
||||
j$.private.isA('Int16Array', value) ||
|
||||
j$.private.isA('Int32Array', value) ||
|
||||
j$.private.isA('Int8Array', value) ||
|
||||
j$.private.isA('Uint16Array', value) ||
|
||||
j$.private.isA('Uint32Array', value) ||
|
||||
j$.private.isA('Uint8Array', value) ||
|
||||
j$.private.isA('Uint8ClampedArray', value)
|
||||
);
|
||||
};
|
||||
|
||||
j$.private.isA = function(typeName, value) {
|
||||
return j$.private.getType(value) === '[object ' + typeName + ']';
|
||||
};
|
||||
|
||||
j$.private.isError = function(value) {
|
||||
if (!value) {
|
||||
return false;
|
||||
}
|
||||
@@ -126,15 +132,15 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return typeof value.stack === 'string' && typeof value.message === 'string';
|
||||
};
|
||||
|
||||
j$.isAsymmetricEqualityTester_ = function(obj) {
|
||||
return obj ? j$.isA_('Function', obj.asymmetricMatch) : false;
|
||||
j$.private.isAsymmetricEqualityTester = function(obj) {
|
||||
return obj ? j$.private.isA('Function', obj.asymmetricMatch) : false;
|
||||
};
|
||||
|
||||
j$.getType_ = function(value) {
|
||||
j$.private.getType = function(value) {
|
||||
return Object.prototype.toString.apply(value);
|
||||
};
|
||||
|
||||
j$.isDomNode = function(obj) {
|
||||
j$.private.isDomNode = function(obj) {
|
||||
// Node is a function, because constructors
|
||||
return typeof jasmineGlobal.Node !== 'undefined'
|
||||
? obj instanceof jasmineGlobal.Node
|
||||
@@ -145,7 +151,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
// return obj.nodeType > 0;
|
||||
};
|
||||
|
||||
j$.isMap = function(obj) {
|
||||
j$.private.isMap = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
@@ -153,7 +159,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
);
|
||||
};
|
||||
|
||||
j$.isSet = function(obj) {
|
||||
j$.private.isSet = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
@@ -161,7 +167,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
);
|
||||
};
|
||||
|
||||
j$.isWeakMap = function(obj) {
|
||||
j$.private.isWeakMap = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
@@ -169,7 +175,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
);
|
||||
};
|
||||
|
||||
j$.isURL = function(obj) {
|
||||
j$.private.isURL = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
@@ -177,11 +183,11 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
);
|
||||
};
|
||||
|
||||
j$.isIterable_ = function(value) {
|
||||
j$.private.isIterable = function(value) {
|
||||
return value && !!value[Symbol.iterator];
|
||||
};
|
||||
|
||||
j$.isDataView = function(obj) {
|
||||
j$.private.isDataView = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
@@ -189,15 +195,15 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
);
|
||||
};
|
||||
|
||||
j$.isPromise = function(obj) {
|
||||
j$.private.isPromise = function(obj) {
|
||||
return !!obj && obj.constructor === jasmineGlobal.Promise;
|
||||
};
|
||||
|
||||
j$.isPromiseLike = function(obj) {
|
||||
return !!obj && j$.isFunction_(obj.then);
|
||||
j$.private.isPromiseLike = function(obj) {
|
||||
return !!obj && j$.private.isFunction(obj.then);
|
||||
};
|
||||
|
||||
j$.fnNameFor = function(func) {
|
||||
j$.private.fnNameFor = function(func) {
|
||||
if (func.name) {
|
||||
return func.name;
|
||||
}
|
||||
@@ -209,7 +215,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return matches ? matches[1] : '<anonymous>';
|
||||
};
|
||||
|
||||
j$.isPending_ = function(promise) {
|
||||
j$.private.isPending = function(promise) {
|
||||
const sentinel = {};
|
||||
return Promise.race([promise, Promise.resolve(sentinel)]).then(
|
||||
function(result) {
|
||||
@@ -231,7 +237,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Constructor} clazz - The constructor to check against.
|
||||
*/
|
||||
j$.any = function(clazz) {
|
||||
return new j$.Any(clazz);
|
||||
return new j$.private.Any(clazz);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -243,7 +249,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @function
|
||||
*/
|
||||
j$.anything = function() {
|
||||
return new j$.Anything();
|
||||
return new j$.private.Anything();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -255,7 +261,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @function
|
||||
*/
|
||||
j$.truthy = function() {
|
||||
return new j$.Truthy();
|
||||
return new j$.private.Truthy();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -268,7 +274,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @function
|
||||
*/
|
||||
j$.falsy = function() {
|
||||
return new j$.Falsy();
|
||||
return new j$.private.Falsy();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -280,7 +286,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @function
|
||||
*/
|
||||
j$.empty = function() {
|
||||
return new j$.Empty();
|
||||
return new j$.private.Empty();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -292,7 +298,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Object} sample - The value to compare the actual to.
|
||||
*/
|
||||
j$.is = function(sample) {
|
||||
return new j$.Is(sample);
|
||||
return new j$.private.Is(sample);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -304,7 +310,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @function
|
||||
*/
|
||||
j$.notEmpty = function() {
|
||||
return new j$.NotEmpty();
|
||||
return new j$.private.NotEmpty();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -317,7 +323,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Object} sample - The subset of properties that _must_ be in the actual.
|
||||
*/
|
||||
j$.objectContaining = function(sample) {
|
||||
return new j$.ObjectContaining(sample);
|
||||
return new j$.private.ObjectContaining(sample);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -330,7 +336,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {RegExp|String} expected
|
||||
*/
|
||||
j$.stringMatching = function(expected) {
|
||||
return new j$.StringMatching(expected);
|
||||
return new j$.private.StringMatching(expected);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -343,7 +349,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {String} expected
|
||||
*/
|
||||
j$.stringContaining = function(expected) {
|
||||
return new j$.StringContaining(expected);
|
||||
return new j$.private.StringContaining(expected);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -356,7 +362,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Array} sample
|
||||
*/
|
||||
j$.arrayContaining = function(sample) {
|
||||
return new j$.ArrayContaining(sample);
|
||||
return new j$.private.ArrayContaining(sample);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -370,7 +376,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Array} sample
|
||||
*/
|
||||
j$.arrayWithExactContents = function(sample) {
|
||||
return new j$.ArrayWithExactContents(sample);
|
||||
return new j$.private.ArrayWithExactContents(sample);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -384,7 +390,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Map} sample - The subset of items that _must_ be in the actual.
|
||||
*/
|
||||
j$.mapContaining = function(sample) {
|
||||
return new j$.MapContaining(sample);
|
||||
return new j$.private.MapContaining(sample);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -398,7 +404,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
* @param {Set} sample - The subset of items that _must_ be in the actual.
|
||||
*/
|
||||
j$.setContaining = function(sample) {
|
||||
return new j$.SetContaining(sample);
|
||||
return new j$.private.SetContaining(sample);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -414,8 +420,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
putativeSpy.and instanceof j$.SpyStrategy &&
|
||||
putativeSpy.calls instanceof j$.CallTracker
|
||||
putativeSpy.and instanceof j$.private.SpyStrategy &&
|
||||
putativeSpy.calls instanceof j$.private.CallTracker
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//TODO: expectation result may make more sense as a presentation of an expectation.
|
||||
getJasmineRequireObj().buildExpectationResult = function(j$) {
|
||||
function buildExpectationResult(options) {
|
||||
const exceptionFormatter = new j$.ExceptionFormatter();
|
||||
const exceptionFormatter = new j$.private.ExceptionFormatter();
|
||||
|
||||
/**
|
||||
* Describes the result of evaluating an expectation
|
||||
@@ -24,7 +24,7 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
||||
};
|
||||
|
||||
if (!result.passed) {
|
||||
if (options.error && !j$.isString_(options.error)) {
|
||||
if (options.error && !j$.private.isString(options.error)) {
|
||||
if ('code' in options.error) {
|
||||
result.code = options.error.code;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ getJasmineRequireObj().DiffBuilder = function(j$) {
|
||||
class DiffBuilder {
|
||||
constructor(config) {
|
||||
this.prettyPrinter_ =
|
||||
(config || {}).prettyPrinter || j$.makePrettyPrinter();
|
||||
this.mismatches_ = new j$.MismatchTree();
|
||||
this.path_ = new j$.ObjectPath();
|
||||
(config || {}).prettyPrinter || j$.private.makePrettyPrinter();
|
||||
this.mismatches_ = new j$.private.MismatchTree();
|
||||
this.path_ = new j$.private.ObjectPath();
|
||||
this.actualRoot_ = undefined;
|
||||
this.expectedRoot_ = undefined;
|
||||
}
|
||||
@@ -65,8 +65,8 @@ getJasmineRequireObj().DiffBuilder = function(j$) {
|
||||
|
||||
const handleAsymmetricExpected = () => {
|
||||
if (
|
||||
j$.isAsymmetricEqualityTester_(expected) &&
|
||||
j$.isFunction_(expected.valuesForDiff_)
|
||||
j$.private.isAsymmetricEqualityTester(expected) &&
|
||||
j$.private.isFunction(expected.valuesForDiff_)
|
||||
) {
|
||||
const asymmetricResult = expected.valuesForDiff_(
|
||||
actual,
|
||||
|
||||
@@ -8,7 +8,7 @@ getJasmineRequireObj().MismatchTree = function(j$) {
|
||||
*/
|
||||
class MismatchTree {
|
||||
constructor(path) {
|
||||
this.path = path || new j$.ObjectPath([]);
|
||||
this.path = path || new j$.private.ObjectPath([]);
|
||||
this.formatter = undefined;
|
||||
this.children = [];
|
||||
this.isMismatch = false;
|
||||
|
||||
@@ -11,7 +11,7 @@ getJasmineRequireObj().toBePending = function(j$) {
|
||||
return function toBePending() {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
if (!j$.isPromiseLike(actual)) {
|
||||
if (!j$.private.isPromiseLike(actual)) {
|
||||
throw new Error(
|
||||
`Expected toBePending to be called on a promise but was on a ${typeof actual}.`
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ getJasmineRequireObj().toBeRejected = function(j$) {
|
||||
return function toBeRejected() {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
if (!j$.isPromiseLike(actual)) {
|
||||
if (!j$.private.isPromiseLike(actual)) {
|
||||
throw new Error(
|
||||
`Expected toBeRejected to be called on a promise but was on a ${typeof actual}.`
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@ getJasmineRequireObj().toBeRejectedWith = function(j$) {
|
||||
return function toBeRejectedWith(matchersUtil) {
|
||||
return {
|
||||
compare: function(actualPromise, expectedValue) {
|
||||
if (!j$.isPromiseLike(actualPromise)) {
|
||||
if (!j$.private.isPromiseLike(actualPromise)) {
|
||||
throw new Error(
|
||||
`Expected toBeRejectedWith to be called on a promise but was on a ${typeof actualPromise}.`
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
return function toBeRejectedWithError(matchersUtil) {
|
||||
return {
|
||||
compare: function(actualPromise, arg1, arg2) {
|
||||
if (!j$.isPromiseLike(actualPromise)) {
|
||||
if (!j$.private.isPromiseLike(actualPromise)) {
|
||||
throw new Error(
|
||||
`Expected toBeRejectedWithError to be called on a promise but was on a ${typeof actualPromise}.`
|
||||
);
|
||||
@@ -41,14 +41,14 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
};
|
||||
|
||||
function matchError(actual, expected, matchersUtil) {
|
||||
if (!j$.isError_(actual)) {
|
||||
if (!j$.private.isError(actual)) {
|
||||
return fail(expected, 'rejected with ' + matchersUtil.pp(actual));
|
||||
}
|
||||
|
||||
if (!(actual instanceof expected.error)) {
|
||||
return fail(
|
||||
expected,
|
||||
'rejected with type ' + j$.fnNameFor(actual.constructor)
|
||||
'rejected with type ' + j$.private.fnNameFor(actual.constructor)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
error: error,
|
||||
message: message,
|
||||
printValue:
|
||||
j$.fnNameFor(error) +
|
||||
j$.private.fnNameFor(error) +
|
||||
(typeof message === 'undefined' ? '' : ': ' + matchersUtil.pp(message))
|
||||
};
|
||||
}
|
||||
@@ -116,7 +116,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
|
||||
function isErrorConstructor(value) {
|
||||
return (
|
||||
typeof value === 'function' &&
|
||||
(value === Error || j$.isError_(value.prototype))
|
||||
(value === Error || j$.private.isError(value.prototype))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ getJasmineRequireObj().toBeResolved = function(j$) {
|
||||
return function toBeResolved(matchersUtil) {
|
||||
return {
|
||||
compare: function(actual) {
|
||||
if (!j$.isPromiseLike(actual)) {
|
||||
if (!j$.private.isPromiseLike(actual)) {
|
||||
throw new Error(
|
||||
`Expected toBeResolved to be called on a promise but was on a ${typeof actual}.`
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@ getJasmineRequireObj().toBeResolvedTo = function(j$) {
|
||||
return function toBeResolvedTo(matchersUtil) {
|
||||
return {
|
||||
compare: function(actualPromise, expectedValue) {
|
||||
if (!j$.isPromiseLike(actualPromise)) {
|
||||
if (!j$.private.isPromiseLike(actualPromise)) {
|
||||
throw new Error(
|
||||
`Expected toBeResolvedTo to be called on a promise but was on a ${typeof actualPromise}.`
|
||||
);
|
||||
|
||||
@@ -36,7 +36,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (j$.isSet(haystack)) {
|
||||
if (j$.private.isSet(haystack)) {
|
||||
// Try .has() first. It should be faster in cases where
|
||||
// needle === something in haystack. Fall back to .equals() comparison
|
||||
// if that fails.
|
||||
@@ -45,7 +45,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
}
|
||||
}
|
||||
|
||||
if (j$.isIterable_(haystack) && !j$.isString_(haystack)) {
|
||||
if (j$.private.isIterable(haystack) && !j$.private.isString(haystack)) {
|
||||
// Arrays, Sets, etc.
|
||||
for (const candidate of haystack) {
|
||||
if (this.equals(candidate, needle)) {
|
||||
@@ -61,7 +61,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
return haystack.indexOf(needle) >= 0;
|
||||
}
|
||||
|
||||
if (j$.isNumber_(haystack.length)) {
|
||||
if (j$.private.isNumber(haystack.length)) {
|
||||
// Objects that are shaped like arrays but aren't iterable
|
||||
for (let i = 0; i < haystack.length; i++) {
|
||||
if (this.equals(haystack[i], needle)) {
|
||||
@@ -108,7 +108,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
bStack,
|
||||
diffBuilder
|
||||
) {
|
||||
if (j$.isFunction_(b.valuesForDiff_)) {
|
||||
if (j$.private.isFunction(b.valuesForDiff_)) {
|
||||
const values = b.valuesForDiff_(a, this.pp);
|
||||
this.eq_(values.other, values.self, aStack, bStack, diffBuilder);
|
||||
} else {
|
||||
@@ -123,8 +123,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
bStack,
|
||||
diffBuilder
|
||||
) {
|
||||
const asymmetricA = j$.isAsymmetricEqualityTester_(a);
|
||||
const asymmetricB = j$.isAsymmetricEqualityTester_(b);
|
||||
const asymmetricA = j$.private.isAsymmetricEqualityTester(a);
|
||||
const asymmetricB = j$.private.isAsymmetricEqualityTester(b);
|
||||
|
||||
if (asymmetricA === asymmetricB) {
|
||||
return undefined;
|
||||
@@ -159,7 +159,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
* @returns {boolean} True if the values are equal
|
||||
*/
|
||||
MatchersUtil.prototype.equals = function(a, b, diffBuilder) {
|
||||
diffBuilder = diffBuilder || j$.NullDiffBuilder();
|
||||
diffBuilder = diffBuilder || j$.private.NullDiffBuilder();
|
||||
diffBuilder.setRoots(a, b);
|
||||
|
||||
return this.eq_(a, b, [], [], diffBuilder);
|
||||
@@ -274,8 +274,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const aIsDomNode = j$.isDomNode(a);
|
||||
const bIsDomNode = j$.isDomNode(b);
|
||||
const aIsDomNode = j$.private.isDomNode(a);
|
||||
const bIsDomNode = j$.private.isDomNode(b);
|
||||
if (aIsDomNode && bIsDomNode) {
|
||||
// At first try to use DOM3 method isEqualNode
|
||||
result = a.isEqualNode(b);
|
||||
@@ -289,8 +289,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const aIsPromise = j$.isPromise(a);
|
||||
const bIsPromise = j$.isPromise(b);
|
||||
const aIsPromise = j$.private.isPromise(a);
|
||||
const bIsPromise = j$.private.isPromise(b);
|
||||
if (aIsPromise && bIsPromise) {
|
||||
return a === b;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
} else if (j$.isMap(a) && j$.isMap(b)) {
|
||||
} else if (j$.private.isMap(a) && j$.private.isMap(b)) {
|
||||
if (a.size != b.size) {
|
||||
diffBuilder.recordMismatch();
|
||||
return false;
|
||||
@@ -377,9 +377,15 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
// otherwise explicitly look up the mapKey in the other Map since we want keys with unique
|
||||
// obj identity (that are otherwise equal) to not match.
|
||||
if (
|
||||
j$.isAsymmetricEqualityTester_(mapKey) ||
|
||||
(j$.isAsymmetricEqualityTester_(cmpKey) &&
|
||||
this.eq_(mapKey, cmpKey, aStack, bStack, j$.NullDiffBuilder()))
|
||||
j$.private.isAsymmetricEqualityTester(mapKey) ||
|
||||
(j$.private.isAsymmetricEqualityTester(cmpKey) &&
|
||||
this.eq_(
|
||||
mapKey,
|
||||
cmpKey,
|
||||
aStack,
|
||||
bStack,
|
||||
j$.private.NullDiffBuilder()
|
||||
))
|
||||
) {
|
||||
mapValueB = b.get(cmpKey);
|
||||
} else {
|
||||
@@ -390,7 +396,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
mapValueB,
|
||||
aStack,
|
||||
bStack,
|
||||
j$.NullDiffBuilder()
|
||||
j$.private.NullDiffBuilder()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -399,7 +405,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
diffBuilder.recordMismatch();
|
||||
return false;
|
||||
}
|
||||
} else if (j$.isSet(a) && j$.isSet(b)) {
|
||||
} else if (j$.private.isSet(a) && j$.private.isSet(b)) {
|
||||
if (a.size != b.size) {
|
||||
diffBuilder.recordMismatch();
|
||||
return false;
|
||||
@@ -435,7 +441,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
otherValue,
|
||||
baseStack,
|
||||
otherStack,
|
||||
j$.NullDiffBuilder()
|
||||
j$.private.NullDiffBuilder()
|
||||
);
|
||||
if (!found && prevStackSize !== baseStack.length) {
|
||||
baseStack.splice(prevStackSize);
|
||||
@@ -450,7 +456,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
diffBuilder.recordMismatch();
|
||||
return false;
|
||||
}
|
||||
} else if (j$.isURL(a) && j$.isURL(b)) {
|
||||
} else if (j$.private.isURL(a) && j$.private.isURL(b)) {
|
||||
// URLs have no enumrable properties, so the default object comparison
|
||||
// would consider any two URLs to be equal.
|
||||
return a.toString() === b.toString();
|
||||
@@ -488,7 +494,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
|
||||
for (const key of aKeys) {
|
||||
// Deep compare each member
|
||||
if (!j$.util.has(b, key)) {
|
||||
if (!j$.private.util.has(b, key)) {
|
||||
diffBuilder.recordMismatch(
|
||||
objectKeysAreDifferentFormatter.bind(null, this.pp)
|
||||
);
|
||||
@@ -518,7 +524,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
const allKeys = (function(o) {
|
||||
const keys = [];
|
||||
for (const key in o) {
|
||||
if (j$.util.has(o, key)) {
|
||||
if (j$.private.util.has(o, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
@@ -559,7 +565,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
// and not in objB.
|
||||
function extraKeysAndValues(objA, objB) {
|
||||
return MatchersUtil.keys(objA)
|
||||
.filter(key => !j$.util.has(objB, key))
|
||||
.filter(key => !j$.private.util.has(objB, key))
|
||||
.map(key => [key, objA[key]]);
|
||||
}
|
||||
|
||||
@@ -598,7 +604,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
|
||||
'Expected ' +
|
||||
path +
|
||||
' to be a kind of ' +
|
||||
j$.fnNameFor(expected.constructor) +
|
||||
j$.private.fnNameFor(expected.constructor) +
|
||||
', but was ' +
|
||||
pp(actual) +
|
||||
'.'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toBeInstanceOf = function(j$) {
|
||||
const usageError = j$.formatErrorMsg(
|
||||
const usageError = j$.private.formatErrorMsg(
|
||||
'<toBeInstanceOf>',
|
||||
'expect(value).toBeInstanceOf(<ConstructorFunction>)'
|
||||
);
|
||||
@@ -20,16 +20,16 @@ getJasmineRequireObj().toBeInstanceOf = function(j$) {
|
||||
compare: function(actual, expected) {
|
||||
const actualType =
|
||||
actual && actual.constructor
|
||||
? j$.fnNameFor(actual.constructor)
|
||||
? j$.private.fnNameFor(actual.constructor)
|
||||
: matchersUtil.pp(actual);
|
||||
const expectedType = expected
|
||||
? j$.fnNameFor(expected)
|
||||
? j$.private.fnNameFor(expected)
|
||||
: matchersUtil.pp(expected);
|
||||
let expectedMatcher;
|
||||
let pass;
|
||||
|
||||
try {
|
||||
expectedMatcher = new j$.Any(expected);
|
||||
expectedMatcher = new j$.private.Any(expected);
|
||||
pass = expectedMatcher.asymmetricMatch(actual);
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
} catch (error) {
|
||||
|
||||
@@ -14,7 +14,9 @@ getJasmineRequireObj().toEqual = function(j$) {
|
||||
const result = {
|
||||
pass: false
|
||||
},
|
||||
diffBuilder = new j$.DiffBuilder({ prettyPrinter: matchersUtil.pp });
|
||||
diffBuilder = new j$.private.DiffBuilder({
|
||||
prettyPrinter: matchersUtil.pp
|
||||
});
|
||||
|
||||
result.pass = matchersUtil.equals(actual, expected, diffBuilder);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveBeenCalled = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveBeenCalled>',
|
||||
'expect(<spyObj>).toHaveBeenCalled()'
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveBeenCalledBefore = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveBeenCalledBefore>',
|
||||
'expect(<spyObj>).toHaveBeenCalledBefore(<spyObj>)'
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveBeenCalledOnceWith>',
|
||||
'expect(<spyObj>).toHaveBeenCalledOnceWith(...arguments)'
|
||||
);
|
||||
@@ -62,7 +62,7 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
|
||||
|
||||
function getDiffs() {
|
||||
return actual.calls.allArgs().map(function(argsForCall, callIx) {
|
||||
const diffBuilder = new j$.DiffBuilder();
|
||||
const diffBuilder = new j$.private.DiffBuilder();
|
||||
matchersUtil.equals(argsForCall, expectedArgs, diffBuilder);
|
||||
return diffBuilder.getMessage();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveBeenCalledTimes>',
|
||||
'expect(<spyObj>).toHaveBeenCalledTimes(<Number>)'
|
||||
);
|
||||
@@ -27,7 +27,7 @@ getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
|
||||
const args = Array.prototype.slice.call(arguments, 0),
|
||||
result = { pass: false };
|
||||
|
||||
if (!j$.isNumber_(expected)) {
|
||||
if (!j$.private.isNumber(expected)) {
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'The expected times failed is a required argument and must be a number.'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveBeenCalledWith>',
|
||||
'expect(<spyObj>).toHaveBeenCalledWith(...arguments)'
|
||||
);
|
||||
@@ -71,7 +71,7 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
||||
const diffs = actual.calls
|
||||
.allArgs()
|
||||
.map(function(argsForCall, callIx) {
|
||||
const diffBuilder = new j$.DiffBuilder();
|
||||
const diffBuilder = new j$.private.DiffBuilder();
|
||||
matchersUtil.equals(argsForCall, expectedArgs, diffBuilder);
|
||||
return (
|
||||
'Call ' +
|
||||
|
||||
@@ -26,7 +26,9 @@ getJasmineRequireObj().toHaveClass = function(j$) {
|
||||
|
||||
function isElement(maybeEl) {
|
||||
return (
|
||||
maybeEl && maybeEl.classList && j$.isFunction_(maybeEl.classList.contains)
|
||||
maybeEl &&
|
||||
maybeEl.classList &&
|
||||
j$.private.isFunction(maybeEl.classList.contains)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ getJasmineRequireObj().toHaveClasses = function(j$) {
|
||||
|
||||
function isElement(maybeEl) {
|
||||
return (
|
||||
maybeEl && maybeEl.classList && j$.isFunction_(maybeEl.classList.contains)
|
||||
maybeEl &&
|
||||
maybeEl.classList &&
|
||||
j$.private.isFunction(maybeEl.classList.contains)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveNoOtherSpyInteractions>',
|
||||
'expect(<spyObj>).toHaveNoOtherSpyInteractions()'
|
||||
);
|
||||
@@ -17,7 +17,7 @@ getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
|
||||
compare: function(actual) {
|
||||
const result = {};
|
||||
|
||||
if (!j$.isObject_(actual)) {
|
||||
if (!j$.private.isObject(actual)) {
|
||||
throw new Error(
|
||||
getErrorMsg('Expected an object, but got ' + typeof actual + '.')
|
||||
);
|
||||
|
||||
@@ -17,15 +17,15 @@ getJasmineRequireObj().toHaveSize = function(j$) {
|
||||
};
|
||||
|
||||
if (
|
||||
j$.isA_('WeakSet', actual) ||
|
||||
j$.isWeakMap(actual) ||
|
||||
j$.isDataView(actual)
|
||||
j$.private.isA('WeakSet', actual) ||
|
||||
j$.private.isWeakMap(actual) ||
|
||||
j$.private.isDataView(actual)
|
||||
) {
|
||||
throw new Error('Cannot get size of ' + actual + '.');
|
||||
}
|
||||
|
||||
let actualSize;
|
||||
if (j$.isSet(actual) || j$.isMap(actual)) {
|
||||
if (j$.private.isSet(actual) || j$.private.isMap(actual)) {
|
||||
actualSize = actual.size;
|
||||
} else if (isLength(actual.length)) {
|
||||
actualSize = actual.length;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toHaveSpyInteractions = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toHaveSpyInteractions>',
|
||||
'expect(<spyObj>).toHaveSpyInteractions()'
|
||||
);
|
||||
@@ -18,7 +18,7 @@ getJasmineRequireObj().toHaveSpyInteractions = function(j$) {
|
||||
compare: function(actual) {
|
||||
const result = {};
|
||||
|
||||
if (!j$.isObject_(actual)) {
|
||||
if (!j$.private.isObject(actual)) {
|
||||
throw new Error(
|
||||
getErrorMsg('Expected a spy object, but got ' + typeof actual + '.')
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toMatch = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toMatch>',
|
||||
'expect(<expectation>).toMatch(<string> || <regexp>)'
|
||||
);
|
||||
@@ -17,7 +17,10 @@ getJasmineRequireObj().toMatch = function(j$) {
|
||||
function toMatch() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
|
||||
if (
|
||||
!j$.private.isString(expected) &&
|
||||
!j$.private.isA('RegExp', expected)
|
||||
) {
|
||||
throw new Error(getErrorMsg('Expected is not a String or a RegExp'));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toThrow = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toThrow>',
|
||||
'expect(function() {<expectation>}).toThrow()'
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toThrowError = function(j$) {
|
||||
const getErrorMsg = j$.formatErrorMsg(
|
||||
const getErrorMsg = j$.private.formatErrorMsg(
|
||||
'<toThrowError>',
|
||||
'expect(function() {<expectation>}).toThrowError(<ErrorConstructor>, <message>)'
|
||||
);
|
||||
@@ -36,7 +36,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
||||
thrown = e;
|
||||
}
|
||||
|
||||
if (!j$.isError_(thrown)) {
|
||||
if (!j$.private.isError(thrown)) {
|
||||
return fail(function() {
|
||||
return (
|
||||
'Expected function to throw an Error, but it threw ' +
|
||||
@@ -79,7 +79,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
||||
match: function(error) {
|
||||
return pass(
|
||||
'Expected function not to throw an Error, but it threw ' +
|
||||
j$.fnNameFor(error) +
|
||||
j$.private.fnNameFor(error) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
@@ -108,12 +108,12 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
||||
}
|
||||
|
||||
const errorTypeDescription = errorType
|
||||
? j$.fnNameFor(errorType)
|
||||
? j$.private.fnNameFor(errorType)
|
||||
: 'an exception';
|
||||
|
||||
function thrownDescription(thrown) {
|
||||
const thrownName = errorType
|
||||
? j$.fnNameFor(thrown.constructor)
|
||||
? j$.private.fnNameFor(thrown.constructor)
|
||||
: 'an exception';
|
||||
let thrownMessage = '';
|
||||
|
||||
@@ -179,7 +179,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
|
||||
|
||||
const Surrogate = function() {};
|
||||
Surrogate.prototype = type.prototype;
|
||||
return j$.isError_(new Surrogate());
|
||||
return j$.private.isError(new Surrogate());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
getJasmineRequireObj().toThrowMatching = function(j$) {
|
||||
const usageError = j$.formatErrorMsg(
|
||||
const usageError = j$.private.formatErrorMsg(
|
||||
'<toThrowMatching>',
|
||||
'expect(function() {<expectation>}).toThrowMatching(<Predicate>)'
|
||||
);
|
||||
@@ -53,7 +53,7 @@ getJasmineRequireObj().toThrowMatching = function(j$) {
|
||||
function thrownDescription(thrown) {
|
||||
if (thrown && thrown.constructor) {
|
||||
return (
|
||||
j$.fnNameFor(thrown.constructor) +
|
||||
j$.private.fnNameFor(thrown.constructor) +
|
||||
' with message ' +
|
||||
matchersUtil.pp(thrown.message)
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().reporterEvents = function() {
|
||||
getJasmineRequireObj().reporterEvents = function(j$) {
|
||||
/**
|
||||
* Used to tell Jasmine what optional or uncommonly implemented features
|
||||
* the reporter supports. If not specified, the defaults described in
|
||||
|
||||
@@ -29,92 +29,79 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
||||
}
|
||||
|
||||
getJasmineRequire().core = function(jRequire) {
|
||||
const j$ = {};
|
||||
const j$ = { private: {} };
|
||||
|
||||
jRequire.base(j$, jasmineGlobal);
|
||||
j$.util = jRequire.util(j$);
|
||||
j$.errors = jRequire.errors();
|
||||
j$.formatErrorMsg = jRequire.formatErrorMsg();
|
||||
j$.Any = jRequire.Any(j$);
|
||||
j$.Anything = jRequire.Anything(j$);
|
||||
j$.CallTracker = jRequire.CallTracker(j$);
|
||||
j$.MockDate = jRequire.MockDate(j$);
|
||||
j$.getClearStack = jRequire.clearStack(j$);
|
||||
j$.Clock = jRequire.Clock();
|
||||
j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(j$);
|
||||
j$.Deprecator = jRequire.Deprecator(j$);
|
||||
j$.Configuration = jRequire.Configuration(j$);
|
||||
j$.Env = jRequire.Env(j$);
|
||||
j$.StackTrace = jRequire.StackTrace(j$);
|
||||
j$.ExceptionFormatter = jRequire.ExceptionFormatter(j$);
|
||||
j$.ExpectationFilterChain = jRequire.ExpectationFilterChain();
|
||||
j$.Expector = jRequire.Expector(j$);
|
||||
j$.Expectation = jRequire.Expectation(j$);
|
||||
j$.buildExpectationResult = jRequire.buildExpectationResult(j$);
|
||||
j$.JsApiReporter = jRequire.JsApiReporter(j$);
|
||||
j$.makePrettyPrinter = jRequire.makePrettyPrinter(j$);
|
||||
j$.basicPrettyPrinter_ = j$.makePrettyPrinter();
|
||||
j$.MatchersUtil = jRequire.MatchersUtil(j$);
|
||||
j$.ObjectContaining = jRequire.ObjectContaining(j$);
|
||||
j$.ArrayContaining = jRequire.ArrayContaining(j$);
|
||||
j$.ArrayWithExactContents = jRequire.ArrayWithExactContents(j$);
|
||||
j$.MapContaining = jRequire.MapContaining(j$);
|
||||
j$.SetContaining = jRequire.SetContaining(j$);
|
||||
j$.QueueRunner = jRequire.QueueRunner(j$);
|
||||
j$.NeverSkipPolicy = jRequire.NeverSkipPolicy(j$);
|
||||
j$.SkipAfterBeforeAllErrorPolicy = jRequire.SkipAfterBeforeAllErrorPolicy(
|
||||
j$.private.util = jRequire.util(j$);
|
||||
j$.private.errors = jRequire.errors();
|
||||
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
|
||||
j$.private.Any = jRequire.Any(j$);
|
||||
j$.private.Anything = jRequire.Anything(j$);
|
||||
j$.private.CallTracker = jRequire.CallTracker(j$);
|
||||
j$.private.MockDate = jRequire.MockDate(j$);
|
||||
j$.private.getClearStack = jRequire.clearStack(j$);
|
||||
j$.private.Clock = jRequire.Clock();
|
||||
j$.private.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(j$);
|
||||
j$.private.Deprecator = jRequire.Deprecator(j$);
|
||||
j$.private.Configuration = jRequire.Configuration(j$);
|
||||
j$.private.Env = jRequire.Env(j$);
|
||||
j$.private.StackTrace = jRequire.StackTrace(j$);
|
||||
j$.private.ExceptionFormatter = jRequire.ExceptionFormatter(j$);
|
||||
j$.private.ExpectationFilterChain = jRequire.ExpectationFilterChain();
|
||||
j$.private.Expector = jRequire.Expector(j$);
|
||||
j$.private.Expectation = jRequire.Expectation(j$);
|
||||
j$.private.buildExpectationResult = jRequire.buildExpectationResult(j$);
|
||||
j$.private.JsApiReporter = jRequire.JsApiReporter(j$);
|
||||
j$.private.makePrettyPrinter = jRequire.makePrettyPrinter(j$);
|
||||
j$.private.basicPrettyPrinter = j$.private.makePrettyPrinter();
|
||||
j$.private.MatchersUtil = jRequire.MatchersUtil(j$);
|
||||
j$.private.ObjectContaining = jRequire.ObjectContaining(j$);
|
||||
j$.private.ArrayContaining = jRequire.ArrayContaining(j$);
|
||||
j$.private.ArrayWithExactContents = jRequire.ArrayWithExactContents(j$);
|
||||
j$.private.MapContaining = jRequire.MapContaining(j$);
|
||||
j$.private.SetContaining = jRequire.SetContaining(j$);
|
||||
j$.private.QueueRunner = jRequire.QueueRunner(j$);
|
||||
j$.private.NeverSkipPolicy = jRequire.NeverSkipPolicy(j$);
|
||||
j$.private.SkipAfterBeforeAllErrorPolicy = jRequire.SkipAfterBeforeAllErrorPolicy(
|
||||
j$
|
||||
);
|
||||
j$.CompleteOnFirstErrorSkipPolicy = jRequire.CompleteOnFirstErrorSkipPolicy(
|
||||
j$.private.CompleteOnFirstErrorSkipPolicy = jRequire.CompleteOnFirstErrorSkipPolicy(
|
||||
j$
|
||||
);
|
||||
j$.reporterEvents = jRequire.reporterEvents(j$);
|
||||
j$.ReportDispatcher = jRequire.ReportDispatcher(j$);
|
||||
j$.private.reporterEvents = jRequire.reporterEvents(j$);
|
||||
j$.private.ReportDispatcher = jRequire.ReportDispatcher(j$);
|
||||
j$.ParallelReportDispatcher = jRequire.ParallelReportDispatcher(j$);
|
||||
j$.CurrentRunableTracker = jRequire.CurrentRunableTracker();
|
||||
j$.RunableResources = jRequire.RunableResources(j$);
|
||||
j$.Runner = jRequire.Runner(j$);
|
||||
j$.Spec = jRequire.Spec(j$);
|
||||
j$.Spy = jRequire.Spy(j$);
|
||||
j$.SpyFactory = jRequire.SpyFactory(j$);
|
||||
j$.SpyRegistry = jRequire.SpyRegistry(j$);
|
||||
j$.SpyStrategy = jRequire.SpyStrategy(j$);
|
||||
j$.StringMatching = jRequire.StringMatching(j$);
|
||||
j$.StringContaining = jRequire.StringContaining(j$);
|
||||
j$.UserContext = jRequire.UserContext(j$);
|
||||
j$.Suite = jRequire.Suite(j$);
|
||||
j$.SuiteBuilder = jRequire.SuiteBuilder(j$);
|
||||
j$.private.CurrentRunableTracker = jRequire.CurrentRunableTracker();
|
||||
j$.private.RunableResources = jRequire.RunableResources(j$);
|
||||
j$.private.Runner = jRequire.Runner(j$);
|
||||
j$.private.Spec = jRequire.Spec(j$);
|
||||
j$.private.Spy = jRequire.Spy(j$);
|
||||
j$.private.SpyFactory = jRequire.SpyFactory(j$);
|
||||
j$.private.SpyRegistry = jRequire.SpyRegistry(j$);
|
||||
j$.private.SpyStrategy = jRequire.SpyStrategy(j$);
|
||||
j$.private.StringMatching = jRequire.StringMatching(j$);
|
||||
j$.private.StringContaining = jRequire.StringContaining(j$);
|
||||
j$.private.UserContext = jRequire.UserContext(j$);
|
||||
j$.private.Suite = jRequire.Suite(j$);
|
||||
j$.private.SuiteBuilder = jRequire.SuiteBuilder(j$);
|
||||
j$.Timer = jRequire.Timer();
|
||||
j$.TreeProcessor = jRequire.TreeProcessor(j$);
|
||||
j$.TreeRunner = jRequire.TreeRunner(j$);
|
||||
j$.private.TreeProcessor = jRequire.TreeProcessor(j$);
|
||||
j$.private.TreeRunner = jRequire.TreeRunner(j$);
|
||||
j$.version = jRequire.version();
|
||||
j$.Order = jRequire.Order();
|
||||
j$.DiffBuilder = jRequire.DiffBuilder(j$);
|
||||
j$.NullDiffBuilder = jRequire.NullDiffBuilder(j$);
|
||||
j$.ObjectPath = jRequire.ObjectPath(j$);
|
||||
j$.MismatchTree = jRequire.MismatchTree(j$);
|
||||
j$.private.Order = jRequire.Order();
|
||||
j$.private.DiffBuilder = jRequire.DiffBuilder(j$);
|
||||
j$.private.NullDiffBuilder = jRequire.NullDiffBuilder(j$);
|
||||
j$.private.ObjectPath = jRequire.ObjectPath(j$);
|
||||
j$.private.MismatchTree = jRequire.MismatchTree(j$);
|
||||
j$.private.GlobalErrors = jRequire.GlobalErrors(j$);
|
||||
j$.private.Truthy = jRequire.Truthy(j$);
|
||||
j$.private.Falsy = jRequire.Falsy(j$);
|
||||
j$.private.Empty = jRequire.Empty(j$);
|
||||
j$.private.NotEmpty = jRequire.NotEmpty(j$);
|
||||
j$.private.Is = jRequire.Is(j$);
|
||||
|
||||
// zone.js tries to monkey patch GlobalErrors in a way that is either a
|
||||
// no-op or causes Jasmine to crash, depending on whether it's done before
|
||||
// or after env creation. Prevent that.
|
||||
const GlobalErrors = jRequire.GlobalErrors(j$);
|
||||
Object.defineProperty(j$, 'GlobalErrors', {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get() {
|
||||
return GlobalErrors;
|
||||
},
|
||||
set() {}
|
||||
});
|
||||
|
||||
j$.Truthy = jRequire.Truthy(j$);
|
||||
j$.Falsy = jRequire.Falsy(j$);
|
||||
j$.Empty = jRequire.Empty(j$);
|
||||
j$.NotEmpty = jRequire.NotEmpty(j$);
|
||||
j$.Is = jRequire.Is(j$);
|
||||
|
||||
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||
j$.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
|
||||
j$.private.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||
j$.private.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
|
||||
|
||||
return j$;
|
||||
};
|
||||
|
||||
@@ -352,7 +352,7 @@ getJasmineRequireObj().interface = function(jasmine, env) {
|
||||
return env.spyOnAllFunctions(obj, includeNonEnumerable);
|
||||
},
|
||||
|
||||
jsApiReporter: new jasmine.JsApiReporter({
|
||||
jsApiReporter: new jasmine.private.JsApiReporter({
|
||||
timer: new jasmine.Timer()
|
||||
}),
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ getJasmineRequireObj().util = function(j$) {
|
||||
} else if (str === '[object Date]') {
|
||||
return new Date(arg.valueOf());
|
||||
} else {
|
||||
return j$.util.clone(arg);
|
||||
return j$.private.util.clone(arg);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -49,7 +49,7 @@ getJasmineRequireObj().util = function(j$) {
|
||||
};
|
||||
|
||||
function callerFile() {
|
||||
const trace = new j$.StackTrace(new Error());
|
||||
const trace = new j$.private.StackTrace(new Error());
|
||||
return trace.frames[1].file;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
jasmineRequire.HtmlReporter = function(j$) {
|
||||
function ResultsStateBuilder() {
|
||||
this.topResults = new j$.ResultsNode({}, '', null);
|
||||
this.topResults = new j$.private.ResultsNode({}, '', null);
|
||||
this.currentParent = this.topResults;
|
||||
this.specsExecuted = 0;
|
||||
this.failureCount = 0;
|
||||
@@ -758,7 +758,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
const el = createElement(type);
|
||||
let children;
|
||||
|
||||
if (j$.isArray_(childrenArrayOrVarArgs)) {
|
||||
if (j$.private.isArray(childrenArrayOrVarArgs)) {
|
||||
children = childrenArrayOrVarArgs;
|
||||
} else {
|
||||
children = [];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
|
||||
|
||||
jasmineRequire.html = function(j$) {
|
||||
j$.ResultsNode = jasmineRequire.ResultsNode();
|
||||
j$.private.ResultsNode = jasmineRequire.ResultsNode();
|
||||
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||
j$.QueryString = jasmineRequire.QueryString();
|
||||
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
||||
|
||||
Reference in New Issue
Block a user