Redesigned moudule system

* Top level private APIs (e.g. jasmine.private.whatever) are no longer
  exposed
* jasmineRequire is no longer exposed
* core is self-booting
* Globals are automatically created in browsers. (They can subsequently
  be removed by user code if desired.)
* Globals are *not* automatically created in Node. An installGlobals
  function is exported instead. The jasmine package calls installGlobals
  unless configured not to do so.
* In Node, the same instance is returned each time jasmine-core is
  imported. A reset function is exported. It effectively resets all state
  by discarding the env and creating a new one. This allows mulitple
  sequential runs within the same process to be independent of each
  other, but does not allow multiple concurrent runs. (That probably never
  worked anyway.)

Fixes #2094
This commit is contained in:
Steve Gravrock
2026-02-15 13:41:19 -08:00
parent 03006080d4
commit f12f4395f0
127 changed files with 1336 additions and 1367 deletions

View File

@@ -8,10 +8,10 @@
<link rel="stylesheet" href="lib/jasmine-<%= jasmineVersion %>/jasmine.css">
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine.js"></script>
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine-html.js"></script>
<script src="lib/jasmine-<%= jasmineVersion %>/boot0.js"></script>
<script src="lib/jasmine-<%= jasmineVersion %>/jasmine-html.js"></script>
<!-- optional: include a file here that configures the Jasmine env -->
<script src="lib/jasmine-<%= jasmineVersion %>/boot1.js"></script>
<script src="lib/jasmine-<%= jasmineVersion %>/boot.js"></script>
<!-- include source files here... -->
<script src="src/Player.js"></script>

View File

@@ -1,18 +1,5 @@
'use strict';
/**
This file finishes 'booting' Jasmine, performing all of the necessary
initialization before executing the loaded environment and all of a project's
specs. This file should be loaded after `boot0.js` but before any project
source files or spec files are loaded. Thus this file can also be used to
customize Jasmine for a project.
If a project is using Jasmine via the standalone distribution, this file can
be customized directly. If you only wish to configure the Jasmine env, you
can load another file that calls `jasmine.getEnv().configure({...})`
after `boot0.js` is loaded and before this file is loaded.
*/
(function() {
const env = jasmine.getEnv();
const urls = new jasmine.HtmlReporterV2Urls();
@@ -25,11 +12,16 @@
*/
env.configure(urls.configFromCurrentUrl());
window.addEventListener('load', function() {
const currentWindowOnload = window.onload;
window.onload = function() {
if (currentWindowOnload) {
currentWindowOnload();
}
// The HTML reporter needs to be set up here so it can access the DOM. Other
// reporters can be added at any time before env.execute() is called.
const htmlReporter = new jasmine.HtmlReporterV2({ env, urls });
env.addReporter(htmlReporter);
env.execute();
});
};
})();

View File

@@ -1,44 +0,0 @@
'use strict';
/**
This file starts the process of "booting" Jasmine. It initializes Jasmine,
makes its globals available, and creates the env. This file should be loaded
after `jasmine.js` and `jasmine_html.js`, but before `boot1.js` or any project
source files or spec files are loaded.
*/
(function() {
const jasmineRequire = window.jasmineRequire || require('./jasmine.js');
/**
* ## Require &amp; Instantiate
*
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
*/
const jasmine = jasmineRequire.core(jasmineRequire),
global = jasmine.getGlobal();
global.jasmine = jasmine;
/**
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
*/
jasmineRequire.html(jasmine);
/**
* Create the Jasmine environment. This is used to run all specs in a project.
*/
const env = jasmine.getEnv();
/**
* ## The Global Interface
*
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
*/
const jasmineInterface = jasmineRequire.interface(jasmine, env);
/**
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
*/
for (const property in jasmineInterface) {
global[property] = jasmineInterface[property];
}
})();

View File

@@ -1,69 +1,24 @@
'use strict';
/**
* Note: Only available on Node.
* @module jasmine-core
*/
const path = require('path');
const fs = require('fs');
const {
globals,
installGlobals,
private$
} = require('./jasmine-core/jasmine.js');
const jasmineRequire = require('./jasmine-core/jasmine.js');
module.exports = jasmineRequire;
const bootWithoutGlobals = (function() {
let jasmine, jasmineInterface;
return function bootWithoutGlobals(reinitialize) {
if (!jasmineInterface || reinitialize === true) {
jasmine = jasmineRequire.core(jasmineRequire);
const env = jasmine.getEnv({ suppressLoadErrors: true });
jasmineInterface = jasmineRequire.interface(jasmine, env);
}
return { jasmine, jasmineInterface };
};
})();
/**
* Boots a copy of Jasmine and returns an object as described in {@link jasmine}.
* @param {boolean} [reinitialize=true] Whether to create a new copy of Jasmine if one already exists
* @type {function}
* @return {jasmine}
*/
module.exports.boot = function(reinitialize) {
if (reinitialize === undefined) {
reinitialize = true;
}
const { jasmine, jasmineInterface } = bootWithoutGlobals(reinitialize);
for (const k in jasmineInterface) {
global[k] = jasmineInterface[k];
}
return jasmine;
};
/**
* Boots a copy of Jasmine and returns an object containing the properties
* that would normally be added to the global object. If noGlobals is called
* multiple times, the same object is returned every time.
*
* @example
* const {describe, beforeEach, it, expect, jasmine} = require('jasmine-core').noGlobals();
*/
module.exports.noGlobals = function() {
const { jasmineInterface } = bootWithoutGlobals(false);
return jasmineInterface;
};
const path = require('path'),
fs = require('fs');
function reset() {
private$.currentEnv_ = null;
const env = jasmine.getEnv({ suppressLoadErrors: true });
rebindInterface(env);
}
const rootPath = path.join(__dirname, 'jasmine-core'),
bootFiles = ['boot0.js', 'boot1.js'],
legacyBootFiles = ['boot.js'],
bootFiles = ['boot.js'],
cssFiles = [],
jsFiles = [],
jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles);
jsFilesToSkip = ['jasmine.js'].concat(bootFiles);
fs.readdirSync(rootPath).forEach(function(file) {
if (fs.statSync(path.join(rootPath, file)).isFile()) {
@@ -80,12 +35,35 @@ fs.readdirSync(rootPath).forEach(function(file) {
}
});
module.exports.files = {
self: __filename,
path: rootPath,
bootDir: rootPath,
bootFiles: bootFiles,
cssFiles: cssFiles,
jsFiles: ['jasmine.js'].concat(jsFiles),
imagesDir: path.join(__dirname, '../images')
/**
* Note: Only available on Node.
*
* In addition to the members documented here, this module's exports include all
* {@link globals}.
* @module jasmine-core
*/
module.exports = {
...globals,
/**
* Copies Jasmine globals (jasmine, describe, it, etc) to the specified
* object or to globalThis.
* @function
* @param {object} [dest] - The object to copy globals to.
*/
installGlobals,
/**
* Resets all of jasmine-core's state, including removing specs, suites, and
* reporters, and resetting configuration to the default.
* @function
*/
reset,
files: {
self: __filename,
path: rootPath,
bootDir: rootPath,
bootFiles: bootFiles,
cssFiles: cssFiles,
jsFiles: ['jasmine.js'].concat(jsFiles),
imagesDir: path.join(__dirname, '../images')
}
};

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().CallTracker = function(j$) {
getJasmineRequireObj().CallTracker = function(j$, private$) {
'use strict';
/**
@@ -125,9 +125,7 @@ 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$.private.util.cloneArgs
) {
this.saveArgumentsByValue = function(argsCloner = private$.util.cloneArgs) {
opts.cloneArgs = true;
opts.argsCloner = argsCloner;
};

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Clock = function(j$) {
getJasmineRequireObj().Clock = function(j$, private$) {
'use strict';
/* global process */

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$) {
getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$, private$) {
'use strict';
function CompleteOnFirstErrorSkipPolicy(queueableFns) {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Configuration = function(j$) {
getJasmineRequireObj().Configuration = function(j$, private$) {
'use strict';
/**

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
getJasmineRequireObj().DelayedFunctionScheduler = function(j$, private$) {
'use strict';
function DelayedFunctionScheduler() {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Deprecator = function(j$) {
getJasmineRequireObj().Deprecator = function(j$, private$) {
'use strict';
function Deprecator(topSuite) {
@@ -25,7 +25,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
) {
options = options || {};
if (!this.verbose_ && !j$.private.isError(deprecation)) {
if (!this.verbose_ && !private$.isError(deprecation)) {
if (this.toSuppress_.indexOf(deprecation) !== -1) {
return;
}
@@ -37,7 +37,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
};
Deprecator.prototype.log_ = function(runnable, deprecation, options) {
if (j$.private.isError(deprecation)) {
if (private$.isError(deprecation)) {
// eslint-disable-next-line no-console
console.error(deprecation);
return;
@@ -66,7 +66,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
};
Deprecator.prototype.stackTrace_ = function() {
const formatter = new j$.private.ExceptionFormatter();
const formatter = new private$.ExceptionFormatter();
return formatter.stack(new Error()).replace(/^Error\n/m, '');
};
@@ -75,7 +75,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
runnable = this.topSuite_;
}
if (j$.private.isError(deprecation)) {
if (private$.isError(deprecation)) {
runnable.addDeprecationWarning(deprecation);
return;
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Env = function(j$) {
getJasmineRequireObj().Env = function(j$, private$) {
'use strict';
const DEFAULT_IT_DESCRIBE_STACK_DEPTH = 3;
@@ -15,18 +15,18 @@ getJasmineRequireObj().Env = function(j$) {
envOptions = envOptions || {};
const self = this;
const GlobalErrors = envOptions.GlobalErrors || j$.private.GlobalErrors;
const GlobalErrors = envOptions.GlobalErrors || private$.GlobalErrors;
const global = envOptions.global || j$.getGlobal();
const realSetTimeout = global.setTimeout;
const realClearTimeout = global.clearTimeout;
const stackClearer = j$.private.getStackClearer(global);
this.clock = new j$.private.Clock(
const stackClearer = private$.getStackClearer(global);
this.clock = new private$.Clock(
global,
function() {
return new j$.private.DelayedFunctionScheduler();
return new private$.DelayedFunctionScheduler();
},
new j$.private.MockDate(global)
new private$.MockDate(global)
);
const globalErrors = new GlobalErrors(
@@ -54,7 +54,7 @@ getJasmineRequireObj().Env = function(j$) {
};
})();
const runableResources = new j$.private.RunableResources({
const runableResources = new private$.RunableResources({
getCurrentRunableId: function() {
const r = runner.currentRunable();
return r ? r.id : null;
@@ -67,7 +67,7 @@ getJasmineRequireObj().Env = function(j$) {
let runner;
let parallelLoadingState = null; // 'specs', 'helpers', or null for non-parallel
const config = new j$.private.Configuration();
const config = new private$.Configuration();
if (!envOptions.suppressLoadErrors) {
installGlobalErrors();
@@ -137,11 +137,11 @@ getJasmineRequireObj().Env = function(j$) {
runableResources.customObjectFormatters().push(formatter);
};
j$.private.Expectation.addCoreMatchers(j$.private.matchers);
j$.private.Expectation.addAsyncCoreMatchers(j$.private.asyncMatchers);
private$.Expectation.addCoreMatchers(private$.matchers);
private$.Expectation.addAsyncCoreMatchers(private$.asyncMatchers);
const expectationFactory = function(actual, spec) {
return j$.private.Expectation.factory({
return private$.Expectation.factory({
matchersUtil: runableResources.makeMatchersUtil(),
customMatchers: runableResources.customMatchers(),
actual: actual,
@@ -174,7 +174,7 @@ getJasmineRequireObj().Env = function(j$) {
};
const throwUnlessFactory = function(actual, spec) {
return j$.private.Expectation.factory({
return private$.Expectation.factory({
matchersUtil: runableResources.makeMatchersUtil(),
customMatchers: runableResources.customMatchers(),
actual: actual,
@@ -183,7 +183,7 @@ getJasmineRequireObj().Env = function(j$) {
};
const throwUnlessAsyncFactory = function(actual, spec) {
return j$.private.Expectation.asyncFactory({
return private$.Expectation.asyncFactory({
matchersUtil: runableResources.makeMatchersUtil(),
customAsyncMatchers: runableResources.customAsyncMatchers(),
actual: actual,
@@ -198,7 +198,7 @@ getJasmineRequireObj().Env = function(j$) {
error.matcherName !== undefined && error.passed !== undefined;
const result = isExpectationResult
? error
: j$.private.buildExpectationResult({
: private$.buildExpectationResult({
error,
passed: false,
matcherName: '',
@@ -259,7 +259,7 @@ getJasmineRequireObj().Env = function(j$) {
}
const asyncExpectationFactory = function(actual, spec, runableType) {
return j$.private.Expectation.asyncFactory({
return private$.Expectation.asyncFactory({
matchersUtil: runableResources.makeMatchersUtil(),
customAsyncMatchers: runableResources.customAsyncMatchers(),
actual: actual,
@@ -318,10 +318,10 @@ getJasmineRequireObj().Env = function(j$) {
(runner.currentRunable() || topSuite).handleException(e);
};
new j$.private.QueueRunner(options).execute();
new private$.QueueRunner(options).execute();
}
const suiteBuilder = new j$.private.SuiteBuilder({
const suiteBuilder = new private$.SuiteBuilder({
env: this,
expectationFactory,
asyncExpectationFactory,
@@ -330,7 +330,7 @@ getJasmineRequireObj().Env = function(j$) {
});
topSuite = suiteBuilder.topSuite;
const deprecator =
envOptions?.deprecator ?? new j$.private.Deprecator(topSuite);
envOptions?.deprecator ?? new private$.Deprecator(topSuite);
/**
* Provides the root suite, through which all suites and specs can be
@@ -350,23 +350,23 @@ getJasmineRequireObj().Env = function(j$) {
* @interface Reporter
* @see custom_reporter
*/
reportDispatcher = new j$.private.ReportDispatcher(
j$.private.reporterEvents,
reportDispatcher = new private$.ReportDispatcher(
private$.reporterEvents,
function(options) {
options.SkipPolicy = j$.private.NeverSkipPolicy;
options.SkipPolicy = private$.NeverSkipPolicy;
return runQueue(options);
},
recordLateError
);
runner = new j$.private.Runner({
runner = new private$.Runner({
topSuite,
totalSpecsDefined: () => suiteBuilder.totalSpecsDefined,
focusedRunables: () => suiteBuilder.focusedRunables,
runableResources,
reportDispatcher,
runQueue,
TreeProcessor: j$.private.TreeProcessor,
TreeProcessor: private$.TreeProcessor,
globalErrors,
getConfig: () => config
});
@@ -411,7 +411,7 @@ getJasmineRequireObj().Env = function(j$) {
// Karma incorrectly loads jasmine-core as an ES module. It isn't one,
// and we don't test that configuration. Warn about it.
if (j$.private.loadedAsBrowserEsm) {
if (private$.loadedAsBrowserEsm) {
this.deprecated(
"jasmine-core isn't an ES module but it was loaded as one. This is not a supported configuration."
);
@@ -540,7 +540,7 @@ getJasmineRequireObj().Env = function(j$) {
try {
const maybePromise = fn(spy);
if (!j$.private.isPromiseLike(maybePromise)) {
if (!private$.isPromiseLike(maybePromise)) {
throw new Error(
'The callback to spyOnGlobalErrorsAsync must be an async or promise-returning function'
);
@@ -783,7 +783,7 @@ getJasmineRequireObj().Env = function(j$) {
};
this.pending = function(message) {
let fullMessage = j$.private.Spec.pendingSpecExceptionMessage;
let fullMessage = private$.Spec.pendingSpecExceptionMessage;
if (message) {
fullMessage += message;
}
@@ -802,7 +802,7 @@ getJasmineRequireObj().Env = function(j$) {
message += ': ';
if (error.message) {
message += error.message;
} else if (j$.private.isString(error)) {
} else if (private$.isString(error)) {
message += error;
} else {
// pretty print all kind of objects. This includes arrays.
@@ -828,7 +828,7 @@ getJasmineRequireObj().Env = function(j$) {
this.pp = function(value) {
const pp = runner.currentRunable()
? runableResources.makePrettyPrinter()
: j$.private.basicPrettyPrinter;
: private$.basicPrettyPrinter;
return pp(value);
};
@@ -838,7 +838,7 @@ getJasmineRequireObj().Env = function(j$) {
}
function indirectCallerFilename(depth) {
const frames = new j$.private.StackTrace(new Error()).frames;
const frames = new private$.StackTrace(new Error()).frames;
// The specified frame should always exist except in Jasmine's own tests,
// which bypass the global it/describe layer, but could be absent in case
// of misconfiguration. Don't crash if it's absent.

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ExceptionFormatter = function(j$) {
getJasmineRequireObj().ExceptionFormatter = function(j$, private$) {
'use strict';
const ignoredProperties = [
@@ -16,7 +16,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
function ExceptionFormatter(options) {
const jasmineFile =
(options && options.jasmineFile) || j$.private.util.jasmineFile();
(options && options.jasmineFile) || private$.util.jasmineFile();
this.message = function(error) {
let message = '';
@@ -60,7 +60,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
lines.pop();
}
const stackTrace = new j$.private.StackTrace(error);
const stackTrace = new private$.StackTrace(error);
lines = lines.concat(filterJasmine(stackTrace));
if (messageHandling === 'require') {
@@ -114,7 +114,7 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
if (!empty) {
return (
'error properties: ' + j$.private.basicPrettyPrinter(result) + '\n'
'error properties: ' + private$.basicPrettyPrinter(result) + '\n'
);
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Expectation = function(j$) {
getJasmineRequireObj().Expectation = function(j$, private$) {
'use strict';
/**
@@ -6,7 +6,7 @@ getJasmineRequireObj().Expectation = function(j$) {
* @namespace matchers
*/
function Expectation(options) {
this.expector = new j$.private.Expector(options);
this.expector = new private$.Expector(options);
const customMatchers = options.customMatchers || {};
for (const matcherName in customMatchers) {
@@ -82,7 +82,7 @@ getJasmineRequireObj().Expectation = function(j$) {
* @namespace async-matchers
*/
function AsyncExpectation(options) {
this.expector = new j$.private.Expector(options);
this.expector = new private$.Expector(options);
const customAsyncMatchers = options.customAsyncMatchers || {};
for (const matcherName in customAsyncMatchers) {
@@ -175,7 +175,7 @@ getJasmineRequireObj().Expectation = function(j$) {
function negatedFailureMessage(result, matcherName, args, matchersUtil) {
if (result.message) {
if (j$.private.isFunction(result.message)) {
if (private$.isFunction(result.message)) {
return result.message();
} else {
return result.message;
@@ -220,7 +220,7 @@ getJasmineRequireObj().Expectation = function(j$) {
return function(actual) {
const matcherArgs = arguments;
return j$.private.isPending(actual).then(function(isPending) {
return private$.isPending(actual).then(function(isPending) {
if (isPending) {
return {
pass: false,

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Expector = function(j$) {
getJasmineRequireObj().Expector = function(j$, private$) {
'use strict';
function Expector(options) {
@@ -7,7 +7,7 @@ getJasmineRequireObj().Expector = function(j$) {
};
this.actual = options.actual;
this.addExpectationResult = options.addExpectationResult || function() {};
this.filters = new j$.private.ExpectationFilterChain();
this.filters = new private$.ExpectationFilterChain();
}
Expector.prototype.instantiateMatcher = function(
@@ -41,7 +41,7 @@ getJasmineRequireObj().Expector = function(j$) {
this.matchersUtil,
args
);
} else if (j$.private.isFunction(result.message)) {
} else if (private$.isFunction(result.message)) {
return result.message();
} else {
return result.message;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().GlobalErrors = function(j$) {
getJasmineRequireObj().GlobalErrors = function(j$, private$) {
'use strict';
class GlobalErrors {
@@ -26,7 +26,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
if (
global.process &&
global.process.listeners &&
j$.private.isFunction(global.process.on)
private$.isFunction(global.process.on)
) {
this.#adapter = new NodeAdapter(global, dispatch);
} else {
@@ -183,7 +183,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
const jasmineMessage = 'Unhandled promise rejection: ' + event.reason;
let reason;
if (j$.private.isError(event.reason)) {
if (private$.isError(event.reason)) {
reason = event.reason;
reason.jasmineMessage = jasmineMessage;
} else {
@@ -262,7 +262,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
jasmineMessagePrefix = 'Uncaught exception';
}
if (j$.private.isError(error)) {
if (private$.isError(error)) {
error.jasmineMessage = jasmineMessagePrefix + ': ' + error;
return error;
} else {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().MockDate = function(j$) {
getJasmineRequireObj().MockDate = function(j$, private$) {
'use strict';
function MockDate(global) {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().NeverSkipPolicy = function(j$) {
getJasmineRequireObj().NeverSkipPolicy = function(j$, private$) {
'use strict';
function NeverSkipPolicy(queueableFns) {}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ParallelReportDispatcher = function(j$) {
getJasmineRequireObj().ParallelReportDispatcher = function(j$, private$) {
'use strict';
/**
@@ -16,12 +16,11 @@ 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$.private.ReportDispatcher;
const QueueRunner = deps.QueueRunner || j$.private.QueueRunner;
const globalErrors = deps.globalErrors || new j$.private.GlobalErrors();
const ReportDispatcher = deps.ReportDispatcher || private$.ReportDispatcher;
const QueueRunner = deps.QueueRunner || private$.QueueRunner;
const globalErrors = deps.globalErrors || new private$.GlobalErrors();
const dispatcher = new ReportDispatcher(
j$.private.reporterEvents,
private$.reporterEvents,
function(queueRunnerOptions) {
queueRunnerOptions = {
...queueRunnerOptions,
@@ -85,7 +84,7 @@ getJasmineRequireObj().ParallelReportDispatcher = function(j$) {
}
};
for (const eventName of j$.private.reporterEvents) {
for (const eventName of private$.reporterEvents) {
self[eventName] = dispatcher[eventName].bind(dispatcher);
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().makePrettyPrinter = function(j$) {
getJasmineRequireObj().makePrettyPrinter = function(j$, private$) {
'use strict';
class SinglePrettyPrintRun {
@@ -28,7 +28,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
this.emitScalar('<global>');
} else if (value.jasmineToString) {
this.emitScalar(value.jasmineToString(this.pp_));
} else if (j$.private.isString(value)) {
} else if (private$.isString(value)) {
this.emitString(value);
} else if (j$.isSpy(value)) {
this.emitScalar('spy on ' + value.and.identity);
@@ -42,7 +42,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
} else {
this.emitScalar('Function');
}
} else if (j$.private.isDomNode(value)) {
} else if (private$.isDomNode(value)) {
if (value.tagName) {
this.emitDomElement(value);
} else {
@@ -50,11 +50,11 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
}
} else if (value instanceof Date) {
this.emitScalar('Date(' + value + ')');
} else if (j$.private.isSet(value)) {
} else if (private$.isSet(value)) {
this.emitSet(value);
} else if (j$.private.isMap(value)) {
} else if (private$.isMap(value)) {
this.emitMap(value);
} else if (j$.private.isTypedArray(value)) {
} else if (private$.isTypedArray(value)) {
this.emitTypedArray(value);
} else if (
value.toString &&
@@ -74,7 +74,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
(Array.isArray(value) ? 'Array' : 'Object') +
'>'
);
} else if (Array.isArray(value) || j$.private.isA('Object', value)) {
} else if (Array.isArray(value) || private$.isA('Object', value)) {
this.seen.push(value);
if (Array.isArray(value)) {
this.emitArray(value);
@@ -99,7 +99,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
}
iterateObject(obj, fn) {
const objKeys = j$.private.MatchersUtil.keys(obj, Array.isArray(obj));
const objKeys = private$.MatchersUtil.keys(obj, Array.isArray(obj));
const length = Math.min(objKeys.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
for (let i = 0; i < length; i++) {
@@ -208,7 +208,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
const ctor = obj.constructor;
const constructorName =
typeof ctor === 'function' && obj instanceof ctor
? j$.private.fnNameFor(obj.constructor)
? private$.fnNameFor(obj.constructor)
: 'null';
this.append(constructorName);
@@ -238,7 +238,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
}
emitTypedArray(arr) {
const constructorName = j$.private.fnNameFor(arr.constructor);
const constructorName = private$.fnNameFor(arr.constructor);
const limitedArray = Array.prototype.slice.call(
arr,
0,
@@ -307,7 +307,7 @@ getJasmineRequireObj().makePrettyPrinter = function(j$) {
// iframe, web worker)
try {
return (
j$.private.isFunction(value.toString) &&
private$.isFunction(value.toString) &&
value.toString !== Object.prototype.toString &&
value.toString() !== Object.prototype.toString.call(value)
);

View File

@@ -1,11 +1,11 @@
getJasmineRequireObj().QueueRunner = function(j$) {
getJasmineRequireObj().QueueRunner = function(j$, private$) {
'use strict';
let nextid = 1;
function StopExecutionError() {}
StopExecutionError.prototype = new Error();
j$.private.StopExecutionError = StopExecutionError;
private$.StopExecutionError = StopExecutionError;
function once(fn, onTwice) {
let called = false;
@@ -58,7 +58,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
};
this.onException = attrs.onException || emptyFn;
this.onMultipleDone = attrs.onMultipleDone || fallbackOnMultipleDone;
this.userContext = attrs.userContext || new j$.private.UserContext();
this.userContext = attrs.userContext || new private$.UserContext();
this.timeout = attrs.timeout || {
setTimeout: setTimeout,
clearTimeout: clearTimeout
@@ -69,7 +69,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
popListener: emptyFn
};
const SkipPolicy = attrs.SkipPolicy || j$.private.NeverSkipPolicy;
const SkipPolicy = attrs.SkipPolicy || private$.NeverSkipPolicy;
this.skipPolicy_ = new SkipPolicy(this.queueableFns);
this.errored_ = false;
@@ -192,7 +192,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
if (queueableFn.fn.length === 0) {
maybeThenable = queueableFn.fn.call(this.userContext);
if (maybeThenable && j$.private.isFunction(maybeThenable.then)) {
if (maybeThenable && private$.isFunction(maybeThenable.then)) {
maybeThenable.then(
wrapInPromiseResolutionHandler(next),
onPromiseRejection
@@ -262,11 +262,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
};
QueueRunner.prototype.diagnoseConflictingAsync_ = function(fn, retval) {
if (retval && j$.private.isFunction(retval.then)) {
if (retval && 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$.private.isAsyncFunction(fn)) {
if (private$.isAsyncFunction(fn)) {
this.onException(
new Error(
'An asynchronous before/it/after ' +
@@ -290,7 +290,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
function wrapInPromiseResolutionHandler(fn) {
return function(maybeArg) {
if (j$.private.isError(maybeArg)) {
if (private$.isError(maybeArg)) {
fn(maybeArg);
} else {
fn();

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ReportDispatcher = function(j$) {
getJasmineRequireObj().ReportDispatcher = function(j$, private$) {
'use strict';
function ReportDispatcher(methods, runQueue, onLateError) {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().RunableResources = function(j$) {
getJasmineRequireObj().RunableResources = function(j$, private$) {
'use strict';
class RunableResources {
@@ -7,7 +7,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
this.getCurrentRunableId_ = options.getCurrentRunableId;
this.globalErrors_ = options.globalErrors;
this.spyFactory = new j$.private.SpyFactory(
this.spyFactory = new private$.SpyFactory(
() => {
if (this.getCurrentRunableId_()) {
return this.customSpyStrategies();
@@ -19,7 +19,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
() => this.makeMatchersUtil()
);
this.spyRegistry = new j$.private.SpyRegistry({
this.spyRegistry = new private$.SpyRegistry({
currentSpies: () => this.spies(),
createSpy: (name, originalFn) =>
this.spyFactory.createSpy(name, originalFn)
@@ -50,7 +50,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
];
for (const k of toClone) {
newRes[k] = j$.private.util.clone(parentRes[k]);
newRes[k] = private$.util.clone(parentRes[k]);
}
}
}
@@ -128,18 +128,18 @@ getJasmineRequireObj().RunableResources = function(j$) {
}
makePrettyPrinter() {
return j$.private.makePrettyPrinter(this.customObjectFormatters());
return private$.makePrettyPrinter(this.customObjectFormatters());
}
makeMatchersUtil() {
if (this.getCurrentRunableId_()) {
return new j$.private.MatchersUtil({
return new private$.MatchersUtil({
customTesters: this.customEqualityTesters(),
pp: this.makePrettyPrinter()
});
} else {
return new j$.private.MatchersUtil({
pp: j$.private.basicPrettyPrinter
return new private$.MatchersUtil({
pp: private$.basicPrettyPrinter
});
}
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Runner = function(j$) {
getJasmineRequireObj().Runner = function(j$, private$) {
'use strict';
class Runner {
@@ -26,7 +26,7 @@ getJasmineRequireObj().Runner = function(j$) {
this.#reportDispatcher = options.reportDispatcher;
this.#getConfig = options.getConfig;
this.#executedBefore = false;
this.#currentRunableTracker = new j$.private.CurrentRunableTracker();
this.#currentRunableTracker = new private$.CurrentRunableTracker();
}
currentSpec() {
@@ -66,9 +66,9 @@ getJasmineRequireObj().Runner = function(j$) {
}
}
const order = new j$.private.Order({
const order = new private$.Order({
random: config.random,
seed: j$.private.isNumber(config.seed) ? config.seed + '' : config.seed
seed: private$.isNumber(config.seed) ? config.seed + '' : config.seed
});
const treeProcessor = new this.#TreeProcessor({
@@ -112,7 +112,7 @@ getJasmineRequireObj().Runner = function(j$) {
});
this.#currentRunableTracker.pushSuite(this.#topSuite);
const treeRunner = new j$.private.TreeRunner({
const treeRunner = new private$.TreeRunner({
executionTree: this.#executionTree,
globalErrors: this.#globalErrors,
runableResources: this.#runableResources,

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$) {
getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$, private$) {
'use strict';
function SkipAfterBeforeAllErrorPolicy(queueableFns) {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Spec = function(j$) {
getJasmineRequireObj().Spec = function(j$, private$) {
'use strict';
class Spec {
@@ -46,7 +46,7 @@ getJasmineRequireObj().Spec = function(j$) {
}
addExpectationResult(passed, data, isError) {
const expectationResult = j$.private.buildExpectationResult(data);
const expectationResult = private$.buildExpectationResult(data);
if (passed) {
this.#executionState.passedExpectations.push(expectationResult);
@@ -58,7 +58,7 @@ getJasmineRequireObj().Spec = function(j$) {
}
if (this.#throwOnExpectationFailure && !isError) {
throw new j$.private.errors.ExpectationFailed();
throw new private$.errors.ExpectationFailed();
}
}
}
@@ -72,10 +72,10 @@ 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.
if (!j$.private.isString(key)) {
if (!private$.isString(key)) {
throw new Error('Key must be a string');
}
j$.private.util.assertReporterCloneable(value, 'Value');
private$.util.assertReporterCloneable(value, 'Value');
this.#executionState.properties = this.#executionState.properties || {};
this.#executionState.properties[key] = value;
@@ -208,7 +208,7 @@ getJasmineRequireObj().Spec = function(j$) {
return;
}
if (e instanceof j$.private.errors.ExpectationFailed) {
if (e instanceof private$.errors.ExpectationFailed) {
return;
}
@@ -275,7 +275,7 @@ getJasmineRequireObj().Spec = function(j$) {
deprecation = { message: deprecation };
}
this.#executionState.deprecationWarnings.push(
j$.private.buildExpectationResult(deprecation)
private$.buildExpectationResult(deprecation)
);
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Spy = function(j$) {
getJasmineRequireObj().Spy = function(j$, private$) {
'use strict';
const nextOrder = (function() {
@@ -55,7 +55,7 @@ getJasmineRequireObj().Spy = function(j$) {
},
matchersUtil
),
callTracker = new j$.private.CallTracker();
callTracker = new private$.CallTracker();
function makeFunc(length, fn) {
switch (length) {
@@ -147,9 +147,9 @@ getJasmineRequireObj().Spy = function(j$) {
}
function SpyStrategyDispatcher(strategyArgs, matchersUtil) {
const baseStrategy = new j$.private.SpyStrategy(strategyArgs);
const baseStrategy = new private$.SpyStrategy(strategyArgs);
const argsStrategies = new StrategyDict(function() {
return new j$.private.SpyStrategy(strategyArgs);
return new private$.SpyStrategy(strategyArgs);
}, matchersUtil);
this.and = baseStrategy;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().SpyFactory = function(j$) {
getJasmineRequireObj().SpyFactory = function(j$, private$) {
'use strict';
function SpyFactory(
@@ -7,12 +7,12 @@ getJasmineRequireObj().SpyFactory = function(j$) {
getMatchersUtil
) {
this.createSpy = function(name, originalFn) {
if (j$.private.isFunction(name) && originalFn === undefined) {
if (private$.isFunction(name) && originalFn === undefined) {
originalFn = name;
name = originalFn.name;
}
return j$.private.Spy(name, getMatchersUtil(), {
return private$.Spy(name, getMatchersUtil(), {
originalFn,
customStrategies: getCustomStrategies(),
defaultStrategyFn: getDefaultStrategyFn()
@@ -21,7 +21,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
this.createSpyObj = function(baseName, methodNames, propertyNames) {
const baseNameIsCollection =
j$.private.isObject(baseName) || Array.isArray(baseName);
private$.isObject(baseName) || Array.isArray(baseName);
if (baseNameIsCollection) {
propertyNames = methodNames;
@@ -71,7 +71,7 @@ getJasmineRequireObj().SpyFactory = function(j$) {
for (let i = 0; i < object.length; i++) {
result.push([object[i]]);
}
} else if (j$.private.isObject(object)) {
} else if (private$.isObject(object)) {
for (const key in object) {
if (object.hasOwnProperty(key)) {
result.push([key, object[key]]);

View File

@@ -1,11 +1,11 @@
getJasmineRequireObj().SpyRegistry = function(j$) {
getJasmineRequireObj().SpyRegistry = function(j$, private$) {
'use strict';
const spyOnMsg = j$.private.formatErrorMsg(
const spyOnMsg = private$.formatErrorMsg(
'<spyOn>',
'spyOn(<object>, <methodName>)'
);
const spyOnPropertyMsg = j$.private.formatErrorMsg(
const spyOnPropertyMsg = private$.formatErrorMsg(
'<spyOnProperty>',
'spyOnProperty(<object>, <propName>, [accessType])'
);
@@ -47,7 +47,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
// restored.
if (
obj[methodName] &&
obj[methodName][j$.private.Clock.IsMockClockTimingFn]
obj[methodName][private$.Clock.IsMockClockTimingFn]
) {
throw new Error("Mock clock timing functions can't be spied on");
}
@@ -102,7 +102,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
// localStorage in Firefox and later Safari versions, have no-op setters.
if (obj[methodName] !== spiedMethod) {
throw new Error(
j$.private.formatErrorMsg('<spyOn>')(
private$.formatErrorMsg('<spyOn>')(
`Can't spy on ${methodName} because assigning to it had no effect`
)
);
@@ -130,10 +130,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
throw new Error(getErrorMsg('No property name supplied'));
}
const descriptor = j$.private.util.getPropertyDescriptor(
obj,
propertyName
);
const descriptor = private$.util.getPropertyDescriptor(obj, propertyName);
if (!descriptor) {
throw new Error(getErrorMsg(propertyName + ' property does not exist'));
@@ -168,7 +165,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
}
}
const originalDescriptor = j$.private.util.clone(descriptor);
const originalDescriptor = private$.util.clone(descriptor);
const spy = createSpy(propertyName, descriptor[accessType]);
let restoreStrategy;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().SpyStrategy = function(j$) {
getJasmineRequireObj().SpyStrategy = function(j$, private$) {
'use strict';
/**
@@ -21,7 +21,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
const cs = options.customStrategies || {};
for (const k in cs) {
if (j$.private.util.has(cs, k) && !this[k]) {
if (private$.util.has(cs, k) && !this[k]) {
this[k] = createCustomPlan(cs[k]);
}
}
@@ -59,7 +59,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
return function() {
const plan = factory.apply(null, arguments);
if (!j$.private.isFunction(plan)) {
if (!private$.isFunction(plan)) {
throw new Error('Spy strategy must return a function');
}
@@ -131,7 +131,7 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
* @param {Error|Object|String} something Thing to throw
*/
SpyStrategy.prototype.throwError = function(something) {
const error = j$.private.isString(something)
const error = private$.isString(something)
? new Error(something)
: something;
this.plan = function() {
@@ -150,9 +150,9 @@ getJasmineRequireObj().SpyStrategy = function(j$) {
SpyStrategy.prototype.callFake = function(fn) {
if (
!(
j$.private.isFunction(fn) ||
j$.private.isAsyncFunction(fn) ||
j$.private.isGeneratorFunction(fn)
private$.isFunction(fn) ||
private$.isAsyncFunction(fn) ||
private$.isGeneratorFunction(fn)
)
) {
throw new Error(

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().StackClearer = function(j$) {
getJasmineRequireObj().StackClearer = function(j$, private$) {
'use strict';
const maxInlineCallCount = 10;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().StackTrace = function(j$) {
getJasmineRequireObj().StackTrace = function(j$, private$) {
'use strict';
function StackTrace(error) {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Suite = function(j$) {
getJasmineRequireObj().Suite = function(j$, private$) {
'use strict';
class Suite {
@@ -37,10 +37,10 @@ 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.
if (!j$.private.isString(key)) {
if (!private$.isString(key)) {
throw new Error('Key must be a string');
}
j$.private.util.assertReporterCloneable(value, 'Value');
private$.util.assertReporterCloneable(value, 'Value');
this.#result.properties = this.#result.properties || {};
this.#result.properties[key] = value;
@@ -217,18 +217,18 @@ getJasmineRequireObj().Suite = function(j$) {
if (!this.sharedContext) {
this.sharedContext = this.parentSuite
? this.parentSuite.clonedSharedUserContext()
: new j$.private.UserContext();
: new private$.UserContext();
}
return this.sharedContext;
}
clonedSharedUserContext() {
return j$.private.UserContext.fromExisting(this.sharedUserContext());
return private$.UserContext.fromExisting(this.sharedUserContext());
}
handleException() {
if (arguments[0] instanceof j$.private.errors.ExpectationFailed) {
if (arguments[0] instanceof private$.errors.ExpectationFailed) {
return;
}
@@ -237,7 +237,7 @@ getJasmineRequireObj().Suite = function(j$) {
passed: false,
error: arguments[0]
};
const failedExpectation = j$.private.buildExpectationResult(data);
const failedExpectation = private$.buildExpectationResult(data);
if (!this.parentSuite) {
failedExpectation.globalErrorType = 'afterAll';
@@ -279,7 +279,7 @@ getJasmineRequireObj().Suite = function(j$) {
return;
}
const expectationResult = j$.private.buildExpectationResult(data);
const expectationResult = private$.buildExpectationResult(data);
if (this.reportedDone) {
this.onLateError(expectationResult);
@@ -288,7 +288,7 @@ getJasmineRequireObj().Suite = function(j$) {
}
if (this.#throwOnExpectationFailure) {
throw new j$.private.errors.ExpectationFailed();
throw new private$.errors.ExpectationFailed();
}
}
@@ -297,7 +297,7 @@ getJasmineRequireObj().Suite = function(j$) {
deprecation = { message: deprecation };
}
this.#result.deprecationWarnings.push(
j$.private.buildExpectationResult(deprecation)
private$.buildExpectationResult(deprecation)
);
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().SuiteBuilder = function(j$) {
getJasmineRequireObj().SuiteBuilder = function(j$, private$) {
'use strict';
class SuiteBuilder {
@@ -94,7 +94,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
ensureIsFunctionOrAsync(fn, 'fit');
if (timeout) {
j$.private.util.validateTimeout(timeout);
private$.util.validateTimeout(timeout);
}
const spec = this.specFactory_(description, fn, timeout, filename);
this.currentDeclarationSuite_.addChild(spec);
@@ -107,7 +107,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach');
if (timeout) {
j$.private.util.validateTimeout(timeout);
private$.util.validateTimeout(timeout);
}
this.currentDeclarationSuite_.beforeEach({
@@ -120,7 +120,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll');
if (timeout) {
j$.private.util.validateTimeout(timeout);
private$.util.validateTimeout(timeout);
}
this.currentDeclarationSuite_.beforeAll({
@@ -133,7 +133,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
ensureIsFunctionOrAsync(afterEachFunction, 'afterEach');
if (timeout) {
j$.private.util.validateTimeout(timeout);
private$.util.validateTimeout(timeout);
}
afterEachFunction.isCleanup = true;
@@ -147,7 +147,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
ensureIsFunctionOrAsync(afterAllFunction, 'afterAll');
if (timeout) {
j$.private.util.validateTimeout(timeout);
private$.util.validateTimeout(timeout);
}
this.currentDeclarationSuite_.afterAll({
@@ -158,7 +158,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
it_(description, fn, timeout, filename) {
if (timeout) {
j$.private.util.validateTimeout(timeout);
private$.util.validateTimeout(timeout);
}
this.checkDuplicate_(description, 'spec');
@@ -197,7 +197,7 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
const parentSuite = this.currentDeclarationSuite_;
const reportedParentSuiteId =
parentSuite === this.topSuite ? null : parentSuite.id;
return new j$.private.Suite({
return new private$.Suite({
id: 'suite' + this.nextSuiteId_++,
description,
filename,
@@ -239,7 +239,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$.private.Spec({
const spec = new private$.Spec({
id: 'spec' + this.nextSpecId_++,
filename,
parentSuiteId,
@@ -302,21 +302,21 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
}
function ensureIsFunction(fn, caller) {
if (!j$.private.isFunction(fn)) {
if (!private$.isFunction(fn)) {
throw new Error(
caller +
' expects a function argument; received ' +
j$.private.getType(fn)
private$.getType(fn)
);
}
}
function ensureIsFunctionOrAsync(fn, caller) {
if (!j$.private.isFunction(fn) && !j$.private.isAsyncFunction(fn)) {
if (!private$.isFunction(fn) && !private$.isAsyncFunction(fn)) {
throw new Error(
caller +
' expects a function argument; received ' +
j$.private.getType(fn)
private$.getType(fn)
);
}
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().TreeProcessor = function(j$) {
getJasmineRequireObj().TreeProcessor = function(j$, private$) {
'use strict';
const defaultMin = Infinity;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().TreeRunner = function(j$) {
getJasmineRequireObj().TreeRunner = function(j$, private$) {
'use strict';
class TreeRunner {
@@ -83,14 +83,14 @@ getJasmineRequireObj().TreeRunner = function(j$) {
},
onComplete: () => {
if (spec.status() === 'failed') {
specOverallDone(new j$.private.StopExecutionError('spec failed'));
specOverallDone(new private$.StopExecutionError('spec failed'));
} else {
specOverallDone();
}
},
userContext: spec.userContext(),
runnableName: spec.getFullName.bind(spec),
SkipPolicy: j$.private.CompleteOnFirstErrorSkipPolicy
SkipPolicy: private$.CompleteOnFirstErrorSkipPolicy
});
}
@@ -265,7 +265,7 @@ getJasmineRequireObj().TreeRunner = function(j$) {
async #reportChildrenOfBeforeAllFailure(suite) {
for (const child of suite.children) {
if (child instanceof j$.private.Suite) {
if (child instanceof private$.Suite) {
await this.#reportDispatcher.suiteStarted(child.startedEvent());
await this.#reportChildrenOfBeforeAllFailure(child);
await this.#reportDispatcher.suiteDone(child.doneEvent());
@@ -280,9 +280,9 @@ getJasmineRequireObj().TreeRunner = function(j$) {
#suiteSkipPolicy() {
if (this.#getConfig().stopOnSpecFailure) {
return j$.private.CompleteOnFirstErrorSkipPolicy;
return private$.CompleteOnFirstErrorSkipPolicy;
} else {
return j$.private.SkipAfterBeforeAllErrorPolicy;
return private$.SkipAfterBeforeAllErrorPolicy;
}
}
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().UserContext = function(j$) {
getJasmineRequireObj().UserContext = function(j$, private$) {
'use strict';
function UserContext() {}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().AllOf = function(j$) {
getJasmineRequireObj().AllOf = function(j$, private$) {
'use strict';
function AllOf() {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Any = function(j$) {
getJasmineRequireObj().Any = function(j$, private$) {
'use strict';
function Any(expectedObject) {
@@ -40,7 +40,7 @@ getJasmineRequireObj().Any = function(j$) {
};
Any.prototype.jasmineToString = function() {
return '<jasmine.any(' + j$.private.fnNameFor(this.expectedObject) + ')>';
return '<jasmine.any(' + private$.fnNameFor(this.expectedObject) + ')>';
};
return Any;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Anything = function(j$) {
getJasmineRequireObj().Anything = function(j$, private$) {
'use strict';
function Anything() {}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ArrayContaining = function(j$) {
getJasmineRequireObj().ArrayContaining = function(j$, private$) {
'use strict';
function ArrayContaining(sample) {
@@ -9,7 +9,7 @@ getJasmineRequireObj().ArrayContaining = function(j$) {
if (!Array.isArray(this.sample)) {
throw new Error(
'You must provide an array to arrayContaining, not ' +
j$.private.basicPrettyPrinter(this.sample) +
private$.basicPrettyPrinter(this.sample) +
'.'
);
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ArrayWithExactContents = function(j$) {
getJasmineRequireObj().ArrayWithExactContents = function(j$, private$) {
'use strict';
function ArrayWithExactContents(sample) {
@@ -12,7 +12,7 @@ getJasmineRequireObj().ArrayWithExactContents = function(j$) {
if (!Array.isArray(this.sample)) {
throw new Error(
'You must provide an array to arrayWithExactContents, not ' +
j$.private.basicPrettyPrinter(this.sample) +
private$.basicPrettyPrinter(this.sample) +
'.'
);
}

View File

@@ -1,22 +1,22 @@
getJasmineRequireObj().Empty = function(j$) {
getJasmineRequireObj().Empty = function(j$, private$) {
'use strict';
function Empty() {}
Empty.prototype.asymmetricMatch = function(other) {
if (
j$.private.isString(other) ||
private$.isString(other) ||
Array.isArray(other) ||
j$.private.isTypedArray(other)
private$.isTypedArray(other)
) {
return other.length === 0;
}
if (j$.private.isMap(other) || j$.private.isSet(other)) {
if (private$.isMap(other) || private$.isSet(other)) {
return other.size === 0;
}
if (j$.private.isObject(other)) {
if (private$.isObject(other)) {
return Object.keys(other).length === 0;
}
return false;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Falsy = function(j$) {
getJasmineRequireObj().Falsy = function(j$, private$) {
'use strict';
function Falsy() {}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Is = function(j$) {
getJasmineRequireObj().Is = function(j$, private$) {
'use strict';
class Is {

View File

@@ -1,11 +1,11 @@
getJasmineRequireObj().MapContaining = function(j$) {
getJasmineRequireObj().MapContaining = function(j$, private$) {
'use strict';
function MapContaining(sample) {
if (!j$.private.isMap(sample)) {
if (!private$.isMap(sample)) {
throw new Error(
'You must provide a map to `mapContaining`, not ' +
j$.private.basicPrettyPrinter(sample)
private$.basicPrettyPrinter(sample)
);
}
@@ -13,7 +13,7 @@ getJasmineRequireObj().MapContaining = function(j$) {
}
MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.private.isMap(other)) {
if (!private$.isMap(other)) {
return false;
}

View File

@@ -1,22 +1,22 @@
getJasmineRequireObj().NotEmpty = function(j$) {
getJasmineRequireObj().NotEmpty = function(j$, private$) {
'use strict';
function NotEmpty() {}
NotEmpty.prototype.asymmetricMatch = function(other) {
if (
j$.private.isString(other) ||
private$.isString(other) ||
Array.isArray(other) ||
j$.private.isTypedArray(other)
private$.isTypedArray(other)
) {
return other.length !== 0;
}
if (j$.private.isMap(other) || j$.private.isSet(other)) {
if (private$.isMap(other) || private$.isSet(other)) {
return other.size !== 0;
}
if (j$.private.isObject(other)) {
if (private$.isObject(other)) {
return Object.keys(other).length !== 0;
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ObjectContaining = function(j$) {
getJasmineRequireObj().ObjectContaining = function(j$, private$) {
'use strict';
function ObjectContaining(sample) {
@@ -42,7 +42,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
};
ObjectContaining.prototype.valuesForDiff_ = function(other, pp) {
if (!j$.private.isObject(other)) {
if (!private$.isObject(other)) {
return {
self: this.jasmineToString(pp),
other: other

View File

@@ -1,11 +1,11 @@
getJasmineRequireObj().SetContaining = function(j$) {
getJasmineRequireObj().SetContaining = function(j$, private$) {
'use strict';
function SetContaining(sample) {
if (!j$.private.isSet(sample)) {
if (!private$.isSet(sample)) {
throw new Error(
'You must provide a set to `setContaining`, not ' +
j$.private.basicPrettyPrinter(sample)
private$.basicPrettyPrinter(sample)
);
}
@@ -13,7 +13,7 @@ getJasmineRequireObj().SetContaining = function(j$) {
}
SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
if (!j$.private.isSet(other)) {
if (!private$.isSet(other)) {
return false;
}

View File

@@ -1,8 +1,8 @@
getJasmineRequireObj().StringContaining = function(j$) {
getJasmineRequireObj().StringContaining = function(j$, private$) {
'use strict';
function StringContaining(expected) {
if (!j$.private.isString(expected)) {
if (!private$.isString(expected)) {
throw new Error('Expected is not a String');
}
@@ -10,7 +10,7 @@ getJasmineRequireObj().StringContaining = function(j$) {
}
StringContaining.prototype.asymmetricMatch = function(other) {
if (!j$.private.isString(other)) {
if (!private$.isString(other)) {
// Arrays, etc. don't match no matter what their indexOf returns.
return false;
}

View File

@@ -1,8 +1,8 @@
getJasmineRequireObj().StringMatching = function(j$) {
getJasmineRequireObj().StringMatching = function(j$, private$) {
'use strict';
function StringMatching(expected) {
if (!j$.private.isString(expected) && !j$.private.isA('RegExp', expected)) {
if (!private$.isString(expected) && !private$.isA('RegExp', expected)) {
throw new Error('Expected is not a String or a RegExp');
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().Truthy = function(j$) {
getJasmineRequireObj().Truthy = function(j$, private$) {
'use strict';
function Truthy() {}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().base = function(j$, jasmineGlobal) {
getJasmineRequireObj().base = function(j$, private$, jasmineGlobal) {
'use strict';
/**
@@ -47,7 +47,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return DEFAULT_TIMEOUT_INTERVAL;
},
set: function(newValue) {
j$.private.util.validateTimeout(
private$.util.validateTimeout(
newValue,
'jasmine.DEFAULT_TIMEOUT_INTERVAL'
);
@@ -70,58 +70,58 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
Object.defineProperty(j$, 'getEnv', {
enumerable: true,
value: function(options) {
const env = (j$.private.currentEnv_ =
j$.private.currentEnv_ || new j$.private.Env(options));
const env = (private$.currentEnv_ =
private$.currentEnv_ || new private$.Env(options));
//jasmine. singletons in here (setTimeout blah blah).
return env;
}
});
j$.private.isObject = function(value) {
private$.isObject = function(value) {
return (
value !== undefined && value !== null && j$.private.isA('Object', value)
value !== undefined && value !== null && private$.isA('Object', value)
);
};
j$.private.isString = function(value) {
return j$.private.isA('String', value);
private$.isString = function(value) {
return private$.isA('String', value);
};
j$.private.isNumber = function(value) {
return j$.private.isA('Number', value);
private$.isNumber = function(value) {
return private$.isA('Number', value);
};
j$.private.isFunction = function(value) {
return j$.private.isA('Function', value);
private$.isFunction = function(value) {
return private$.isA('Function', value);
};
j$.private.isAsyncFunction = function(value) {
return j$.private.isA('AsyncFunction', value);
private$.isAsyncFunction = function(value) {
return private$.isA('AsyncFunction', value);
};
j$.private.isGeneratorFunction = function(value) {
return j$.private.isA('GeneratorFunction', value);
private$.isGeneratorFunction = function(value) {
return private$.isA('GeneratorFunction', value);
};
j$.private.isTypedArray = function(value) {
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)
private$.isA('Float32Array', value) ||
private$.isA('Float64Array', value) ||
private$.isA('Int16Array', value) ||
private$.isA('Int32Array', value) ||
private$.isA('Int8Array', value) ||
private$.isA('Uint16Array', value) ||
private$.isA('Uint32Array', value) ||
private$.isA('Uint8Array', value) ||
private$.isA('Uint8ClampedArray', value)
);
};
j$.private.isA = function(typeName, value) {
return j$.private.getType(value) === '[object ' + typeName + ']';
private$.isA = function(typeName, value) {
return private$.getType(value) === '[object ' + typeName + ']';
};
j$.private.isError = function(value) {
private$.isError = function(value) {
if (!value) {
return false;
}
@@ -133,15 +133,15 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return typeof value.stack === 'string' && typeof value.message === 'string';
};
j$.private.isAsymmetricEqualityTester = function(obj) {
return obj ? j$.private.isA('Function', obj.asymmetricMatch) : false;
private$.isAsymmetricEqualityTester = function(obj) {
return obj ? private$.isA('Function', obj.asymmetricMatch) : false;
};
j$.private.getType = function(value) {
private$.getType = function(value) {
return Object.prototype.toString.apply(value);
};
j$.private.isDomNode = function(obj) {
private$.isDomNode = function(obj) {
// Node is a function, because constructors
return typeof jasmineGlobal.Node !== 'undefined'
? obj instanceof jasmineGlobal.Node
@@ -152,7 +152,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
// return obj.nodeType > 0;
};
j$.private.isMap = function(obj) {
private$.isMap = function(obj) {
return (
obj !== null &&
typeof obj !== 'undefined' &&
@@ -160,7 +160,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
);
};
j$.private.isSet = function(obj) {
private$.isSet = function(obj) {
return (
obj !== null &&
typeof obj !== 'undefined' &&
@@ -168,7 +168,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
);
};
j$.private.isWeakMap = function(obj) {
private$.isWeakMap = function(obj) {
return (
obj !== null &&
typeof obj !== 'undefined' &&
@@ -176,7 +176,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
);
};
j$.private.isURL = function(obj) {
private$.isURL = function(obj) {
return (
obj !== null &&
typeof obj !== 'undefined' &&
@@ -184,11 +184,11 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
);
};
j$.private.isIterable = function(value) {
private$.isIterable = function(value) {
return value && !!value[Symbol.iterator];
};
j$.private.isDataView = function(obj) {
private$.isDataView = function(obj) {
return (
obj !== null &&
typeof obj !== 'undefined' &&
@@ -196,15 +196,15 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
);
};
j$.private.isPromise = function(obj) {
private$.isPromise = function(obj) {
return !!obj && obj.constructor === jasmineGlobal.Promise;
};
j$.private.isPromiseLike = function(obj) {
return !!obj && j$.private.isFunction(obj.then);
private$.isPromiseLike = function(obj) {
return !!obj && private$.isFunction(obj.then);
};
j$.private.fnNameFor = function(func) {
private$.fnNameFor = function(func) {
if (func.name) {
return func.name;
}
@@ -216,7 +216,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return matches ? matches[1] : '<anonymous>';
};
j$.private.isPending = function(promise) {
private$.isPending = function(promise) {
const sentinel = {};
return Promise.race([promise, Promise.resolve(sentinel)]).then(
function(result) {
@@ -251,7 +251,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @param {Constructor} clazz - The constructor to check against.
*/
j$.any = function(clazz) {
return new j$.private.Any(clazz);
return new private$.Any(clazz);
};
/**
@@ -263,7 +263,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @function
*/
j$.anything = function() {
return new j$.private.Anything();
return new private$.Anything();
};
/**
@@ -275,7 +275,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @function
*/
j$.truthy = function() {
return new j$.private.Truthy();
return new private$.Truthy();
};
/**
@@ -288,7 +288,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @function
*/
j$.falsy = function() {
return new j$.private.Falsy();
return new private$.Falsy();
};
/**
@@ -300,7 +300,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @function
*/
j$.empty = function() {
return new j$.private.Empty();
return new private$.Empty();
};
/**
@@ -312,7 +312,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @param {Object} sample - The value to compare the actual to.
*/
j$.is = function(sample) {
return new j$.private.Is(sample);
return new private$.Is(sample);
};
/**
@@ -324,7 +324,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @function
*/
j$.notEmpty = function() {
return new j$.private.NotEmpty();
return new private$.NotEmpty();
};
/**
@@ -337,7 +337,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$.private.ObjectContaining(sample);
return new private$.ObjectContaining(sample);
};
/**
@@ -350,7 +350,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @param {RegExp|String} expected
*/
j$.stringMatching = function(expected) {
return new j$.private.StringMatching(expected);
return new private$.StringMatching(expected);
};
/**
@@ -363,7 +363,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @param {String} expected
*/
j$.stringContaining = function(expected) {
return new j$.private.StringContaining(expected);
return new private$.StringContaining(expected);
};
/**
@@ -376,7 +376,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @param {Array} sample
*/
j$.arrayContaining = function(sample) {
return new j$.private.ArrayContaining(sample);
return new private$.ArrayContaining(sample);
};
/**
@@ -390,7 +390,7 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
* @param {Array} sample
*/
j$.arrayWithExactContents = function(sample) {
return new j$.private.ArrayWithExactContents(sample);
return new private$.ArrayWithExactContents(sample);
};
/**
@@ -404,7 +404,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$.private.MapContaining(sample);
return new private$.MapContaining(sample);
};
/**
@@ -418,7 +418,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$.private.SetContaining(sample);
return new private$.SetContaining(sample);
};
/**
@@ -434,8 +434,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return false;
}
return (
putativeSpy.and instanceof j$.private.SpyStrategy &&
putativeSpy.calls instanceof j$.private.CallTracker
putativeSpy.and instanceof private$.SpyStrategy &&
putativeSpy.calls instanceof private$.CallTracker
);
};

View File

@@ -1,9 +1,9 @@
//TODO: expectation result may make more sense as a presentation of an expectation.
getJasmineRequireObj().buildExpectationResult = function(j$) {
getJasmineRequireObj().buildExpectationResult = function(j$, private$) {
'use strict';
function buildExpectationResult(options) {
const exceptionFormatter = new j$.private.ExceptionFormatter();
const exceptionFormatter = new private$.ExceptionFormatter();
/**
* Describes the result of evaluating an expectation
@@ -33,7 +33,7 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
}
if (!result.passed) {
if (options.error && !j$.private.isString(options.error)) {
if (options.error && !private$.isString(options.error)) {
if ('code' in options.error) {
result.code = options.error.code;
}

View File

@@ -1,12 +1,12 @@
getJasmineRequireObj().DiffBuilder = function(j$) {
getJasmineRequireObj().DiffBuilder = function(j$, private$) {
'use strict';
class DiffBuilder {
constructor(config) {
this.prettyPrinter_ =
(config || {}).prettyPrinter || j$.private.makePrettyPrinter();
this.mismatches_ = new j$.private.MismatchTree();
this.path_ = new j$.private.ObjectPath();
(config || {}).prettyPrinter || private$.makePrettyPrinter();
this.mismatches_ = new private$.MismatchTree();
this.path_ = new private$.ObjectPath();
this.actualRoot_ = undefined;
this.expectedRoot_ = undefined;
}
@@ -67,8 +67,8 @@ getJasmineRequireObj().DiffBuilder = function(j$) {
const handleAsymmetricExpected = () => {
if (
j$.private.isAsymmetricEqualityTester(expected) &&
j$.private.isFunction(expected.valuesForDiff_)
private$.isAsymmetricEqualityTester(expected) &&
private$.isFunction(expected.valuesForDiff_)
) {
const asymmetricResult = expected.valuesForDiff_(
actual,

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().MismatchTree = function(j$) {
getJasmineRequireObj().MismatchTree = function(j$, private$) {
'use strict';
/*
@@ -10,7 +10,7 @@ getJasmineRequireObj().MismatchTree = function(j$) {
*/
class MismatchTree {
constructor(path) {
this.path = path || new j$.private.ObjectPath([]);
this.path = path || new private$.ObjectPath([]);
this.formatter = undefined;
this.children = [];
this.isMismatch = false;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().NullDiffBuilder = function(j$) {
getJasmineRequireObj().NullDiffBuilder = function(j$, private$) {
'use strict';
return function() {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().ObjectPath = function(j$) {
getJasmineRequireObj().ObjectPath = function(j$, private$) {
'use strict';
class ObjectPath {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBePending = function(j$) {
getJasmineRequireObj().toBePending = function(j$, private$) {
'use strict';
/**
@@ -13,7 +13,7 @@ getJasmineRequireObj().toBePending = function(j$) {
return function toBePending() {
return {
compare: function(actual) {
if (!j$.private.isPromiseLike(actual)) {
if (!private$.isPromiseLike(actual)) {
throw new Error(
`Expected toBePending to be called on a promise but was on a ${typeof actual}.`
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeRejected = function(j$) {
getJasmineRequireObj().toBeRejected = function(j$, private$) {
'use strict';
/**
@@ -15,7 +15,7 @@ getJasmineRequireObj().toBeRejected = function(j$) {
return function toBeRejected() {
return {
compare: function(actual) {
if (!j$.private.isPromiseLike(actual)) {
if (!private$.isPromiseLike(actual)) {
throw new Error(
`Expected toBeRejected to be called on a promise but was on a ${typeof actual}.`
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeRejectedWith = function(j$) {
getJasmineRequireObj().toBeRejectedWith = function(j$, private$) {
'use strict';
/**
@@ -16,7 +16,7 @@ getJasmineRequireObj().toBeRejectedWith = function(j$) {
return function toBeRejectedWith(matchersUtil) {
return {
compare: function(actualPromise, expectedValue) {
if (!j$.private.isPromiseLike(actualPromise)) {
if (!private$.isPromiseLike(actualPromise)) {
throw new Error(
`Expected toBeRejectedWith to be called on a promise but was on a ${typeof actualPromise}.`
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeRejectedWithError = function(j$) {
getJasmineRequireObj().toBeRejectedWithError = function(j$, private$) {
'use strict';
/**
@@ -19,7 +19,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
return function toBeRejectedWithError(matchersUtil) {
return {
compare: function(actualPromise, arg1, arg2) {
if (!j$.private.isPromiseLike(actualPromise)) {
if (!private$.isPromiseLike(actualPromise)) {
throw new Error(
`Expected toBeRejectedWithError to be called on a promise but was on a ${typeof actualPromise}.`
);
@@ -43,14 +43,14 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
};
function matchError(actual, expected, matchersUtil) {
if (!j$.private.isError(actual)) {
if (!private$.isError(actual)) {
return fail(expected, 'rejected with ' + matchersUtil.pp(actual));
}
if (!(actual instanceof expected.error)) {
return fail(
expected,
'rejected with type ' + j$.private.fnNameFor(actual.constructor)
'rejected with type ' + private$.fnNameFor(actual.constructor)
);
}
@@ -110,7 +110,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
error: error,
message: message,
printValue:
j$.private.fnNameFor(error) +
private$.fnNameFor(error) +
(typeof message === 'undefined' ? '' : ': ' + matchersUtil.pp(message))
};
}
@@ -118,7 +118,7 @@ getJasmineRequireObj().toBeRejectedWithError = function(j$) {
function isErrorConstructor(value) {
return (
typeof value === 'function' &&
(value === Error || j$.private.isError(value.prototype))
(value === Error || private$.isError(value.prototype))
);
}
};

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeResolved = function(j$) {
getJasmineRequireObj().toBeResolved = function(j$, private$) {
'use strict';
/**
@@ -15,7 +15,7 @@ getJasmineRequireObj().toBeResolved = function(j$) {
return function toBeResolved(matchersUtil) {
return {
compare: function(actual) {
if (!j$.private.isPromiseLike(actual)) {
if (!private$.isPromiseLike(actual)) {
throw new Error(
`Expected toBeResolved to be called on a promise but was on a ${typeof actual}.`
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeResolvedTo = function(j$) {
getJasmineRequireObj().toBeResolvedTo = function(j$, private$) {
'use strict';
/**
@@ -16,7 +16,7 @@ getJasmineRequireObj().toBeResolvedTo = function(j$) {
return function toBeResolvedTo(matchersUtil) {
return {
compare: function(actualPromise, expectedValue) {
if (!j$.private.isPromiseLike(actualPromise)) {
if (!private$.isPromiseLike(actualPromise)) {
throw new Error(
`Expected toBeResolvedTo to be called on a promise but was on a ${typeof actualPromise}.`
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().MatchersUtil = function(j$) {
getJasmineRequireObj().MatchersUtil = function(j$, private$) {
'use strict';
/**
@@ -38,7 +38,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
return false;
}
if (j$.private.isSet(haystack)) {
if (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.
@@ -47,7 +47,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
}
}
if (j$.private.isIterable(haystack) && !j$.private.isString(haystack)) {
if (private$.isIterable(haystack) && !private$.isString(haystack)) {
// Arrays, Sets, etc.
for (const candidate of haystack) {
if (this.equals(candidate, needle)) {
@@ -63,7 +63,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
return haystack.indexOf(needle) >= 0;
}
if (j$.private.isNumber(haystack.length)) {
if (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)) {
@@ -110,7 +110,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
bStack,
diffBuilder
) {
if (j$.private.isFunction(b.valuesForDiff_)) {
if (private$.isFunction(b.valuesForDiff_)) {
const values = b.valuesForDiff_(a, this.pp);
this.eq_(values.other, values.self, aStack, bStack, diffBuilder);
} else {
@@ -125,8 +125,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
bStack,
diffBuilder
) {
const asymmetricA = j$.private.isAsymmetricEqualityTester(a);
const asymmetricB = j$.private.isAsymmetricEqualityTester(b);
const asymmetricA = private$.isAsymmetricEqualityTester(a);
const asymmetricB = private$.isAsymmetricEqualityTester(b);
if (asymmetricA === asymmetricB) {
return undefined;
@@ -161,7 +161,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
* @returns {boolean} True if the values are equal
*/
MatchersUtil.prototype.equals = function(a, b, diffBuilder) {
diffBuilder = diffBuilder || j$.private.NullDiffBuilder();
diffBuilder = diffBuilder || private$.NullDiffBuilder();
diffBuilder.setRoots(a, b);
return this.eq_(a, b, [], [], diffBuilder);
@@ -276,8 +276,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
return false;
}
const aIsDomNode = j$.private.isDomNode(a);
const bIsDomNode = j$.private.isDomNode(b);
const aIsDomNode = private$.isDomNode(a);
const bIsDomNode = private$.isDomNode(b);
if (aIsDomNode && bIsDomNode) {
// At first try to use DOM3 method isEqualNode
result = a.isEqualNode(b);
@@ -291,8 +291,8 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
return false;
}
const aIsPromise = j$.private.isPromise(a);
const bIsPromise = j$.private.isPromise(b);
const aIsPromise = private$.isPromise(a);
const bIsPromise = private$.isPromise(b);
if (aIsPromise && bIsPromise) {
return a === b;
}
@@ -346,7 +346,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
if (!result) {
return false;
}
} else if (j$.private.isMap(a) && j$.private.isMap(b)) {
} else if (private$.isMap(a) && private$.isMap(b)) {
if (a.size != b.size) {
diffBuilder.recordMismatch();
return false;
@@ -379,14 +379,14 @@ 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$.private.isAsymmetricEqualityTester(mapKey) ||
(j$.private.isAsymmetricEqualityTester(cmpKey) &&
private$.isAsymmetricEqualityTester(mapKey) ||
(private$.isAsymmetricEqualityTester(cmpKey) &&
this.eq_(
mapKey,
cmpKey,
aStack,
bStack,
j$.private.NullDiffBuilder()
private$.NullDiffBuilder()
))
) {
mapValueB = b.get(cmpKey);
@@ -398,7 +398,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
mapValueB,
aStack,
bStack,
j$.private.NullDiffBuilder()
private$.NullDiffBuilder()
);
}
}
@@ -407,7 +407,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
diffBuilder.recordMismatch();
return false;
}
} else if (j$.private.isSet(a) && j$.private.isSet(b)) {
} else if (private$.isSet(a) && private$.isSet(b)) {
if (a.size != b.size) {
diffBuilder.recordMismatch();
return false;
@@ -443,7 +443,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
otherValue,
baseStack,
otherStack,
j$.private.NullDiffBuilder()
private$.NullDiffBuilder()
);
if (!found && prevStackSize !== baseStack.length) {
baseStack.splice(prevStackSize);
@@ -458,7 +458,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
diffBuilder.recordMismatch();
return false;
}
} else if (j$.private.isURL(a) && j$.private.isURL(b)) {
} else if (private$.isURL(a) && 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();
@@ -496,7 +496,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
for (const key of aKeys) {
// Deep compare each member
if (!j$.private.util.has(b, key)) {
if (!private$.util.has(b, key)) {
diffBuilder.recordMismatch(
objectKeysAreDifferentFormatter.bind(null, this.pp)
);
@@ -526,7 +526,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
const allKeys = (function(o) {
const keys = [];
for (const key in o) {
if (j$.private.util.has(o, key)) {
if (private$.util.has(o, key)) {
keys.push(key);
}
}
@@ -567,7 +567,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
// and not in objB.
function extraKeysAndValues(objA, objB) {
return MatchersUtil.keys(objA)
.filter(key => !j$.private.util.has(objB, key))
.filter(key => !private$.util.has(objB, key))
.map(key => [key, objA[key]]);
}
@@ -606,7 +606,7 @@ getJasmineRequireObj().MatchersUtil = function(j$) {
'Expected ' +
path +
' to be a kind of ' +
j$.private.fnNameFor(expected.constructor) +
private$.fnNameFor(expected.constructor) +
', but was ' +
pp(actual) +
'.'

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) {
getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$, private$) {
'use strict';
const availableMatchers = [
@@ -12,7 +12,7 @@ getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) {
matchers = {};
for (const name of availableMatchers) {
matchers[name] = jRequire[name](j$);
matchers[name] = jRequire[name](j$, private$);
}
return matchers;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
getJasmineRequireObj().requireMatchers = function(jRequire, j$, private$) {
'use strict';
const availableMatchers = [
@@ -41,7 +41,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
matchers = {};
for (const name of availableMatchers) {
matchers[name] = jRequire[name](j$);
matchers[name] = jRequire[name](j$, private$);
}
return matchers;

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBe = function(j$) {
getJasmineRequireObj().toBe = function(j$, private$) {
'use strict';
/**

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toBeInstanceOf = function(j$) {
getJasmineRequireObj().toBeInstanceOf = function(j$, private$) {
'use strict';
const usageError = j$.private.formatErrorMsg(
const usageError = private$.formatErrorMsg(
'<toBeInstanceOf>',
'expect(value).toBeInstanceOf(<ConstructorFunction>)'
);
@@ -22,16 +22,16 @@ getJasmineRequireObj().toBeInstanceOf = function(j$) {
compare: function(actual, expected) {
const actualType =
actual && actual.constructor
? j$.private.fnNameFor(actual.constructor)
? private$.fnNameFor(actual.constructor)
: matchersUtil.pp(actual);
const expectedType = expected
? j$.private.fnNameFor(expected)
? private$.fnNameFor(expected)
: matchersUtil.pp(expected);
let expectedMatcher;
let pass;
try {
expectedMatcher = new j$.private.Any(expected);
expectedMatcher = new private$.Any(expected);
pass = expectedMatcher.asymmetricMatch(actual);
// eslint-disable-next-line no-unused-vars
} catch (error) {

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeNaN = function(j$) {
getJasmineRequireObj().toBeNaN = function(j$, private$) {
'use strict';
/**

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBeNegativeInfinity = function(j$) {
getJasmineRequireObj().toBeNegativeInfinity = function(j$, private$) {
'use strict';
/**

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toBePositiveInfinity = function(j$) {
getJasmineRequireObj().toBePositiveInfinity = function(j$, private$) {
'use strict';
/**

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toEqual = function(j$) {
getJasmineRequireObj().toEqual = function(j$, private$) {
'use strict';
/**
@@ -16,7 +16,7 @@ getJasmineRequireObj().toEqual = function(j$) {
const result = {
pass: false
},
diffBuilder = new j$.private.DiffBuilder({
diffBuilder = new private$.DiffBuilder({
prettyPrinter: matchersUtil.pp
});

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveBeenCalled = function(j$) {
getJasmineRequireObj().toHaveBeenCalled = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalled>',
'expect(<spyObj>).toHaveBeenCalled()'
);

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveBeenCalledBefore = function(j$) {
getJasmineRequireObj().toHaveBeenCalledBefore = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledBefore>',
'expect(<spyObj>).toHaveBeenCalledBefore(<spyObj>)'
);

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledOnceWith>',
'expect(<spyObj>).toHaveBeenCalledOnceWith(...arguments)'
);
@@ -64,7 +64,7 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) {
function getDiffs() {
return actual.calls.allArgs().map(function(argsForCall, callIx) {
const diffBuilder = new j$.private.DiffBuilder();
const diffBuilder = new private$.DiffBuilder();
matchersUtil.equals(argsForCall, expectedArgs, diffBuilder);
return diffBuilder.getMessage();
});

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
getJasmineRequireObj().toHaveBeenCalledTimes = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledTimes>',
'expect(<spyObj>).toHaveBeenCalledTimes(<Number>)'
);
@@ -29,7 +29,7 @@ getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) {
const args = Array.prototype.slice.call(arguments, 0),
result = { pass: false };
if (!j$.private.isNumber(expected)) {
if (!private$.isNumber(expected)) {
throw new Error(
getErrorMsg(
'The expected times failed is a required argument and must be a number.'

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
getJasmineRequireObj().toHaveBeenCalledWith = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveBeenCalledWith>',
'expect(<spyObj>).toHaveBeenCalledWith(...arguments)'
);
@@ -73,7 +73,7 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
const diffs = actual.calls
.allArgs()
.map(function(argsForCall, callIx) {
const diffBuilder = new j$.private.DiffBuilder();
const diffBuilder = new private$.DiffBuilder();
matchersUtil.equals(argsForCall, expectedArgs, diffBuilder);
return (
'Call ' +

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toHaveClass = function(j$) {
getJasmineRequireObj().toHaveClass = function(j$, private$) {
'use strict';
/**
@@ -30,7 +30,7 @@ getJasmineRequireObj().toHaveClass = function(j$) {
return (
maybeEl &&
maybeEl.classList &&
j$.private.isFunction(maybeEl.classList.contains)
private$.isFunction(maybeEl.classList.contains)
);
}

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toHaveClasses = function(j$) {
getJasmineRequireObj().toHaveClasses = function(j$, private$) {
'use strict';
/**
@@ -30,7 +30,7 @@ getJasmineRequireObj().toHaveClasses = function(j$) {
return (
maybeEl &&
maybeEl.classList &&
j$.private.isFunction(maybeEl.classList.contains)
private$.isFunction(maybeEl.classList.contains)
);
}

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveNoOtherSpyInteractions>',
'expect(<spyObj>).toHaveNoOtherSpyInteractions()'
);
@@ -19,7 +19,7 @@ getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
compare: function(actual) {
const result = {};
if (!j$.private.isObject(actual)) {
if (!private$.isObject(actual)) {
throw new Error(
getErrorMsg('Expected an object, but got ' + typeof actual + '.')
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().toHaveSize = function(j$) {
getJasmineRequireObj().toHaveSize = function(j$, private$) {
'use strict';
/**
@@ -19,15 +19,15 @@ getJasmineRequireObj().toHaveSize = function(j$) {
};
if (
j$.private.isA('WeakSet', actual) ||
j$.private.isWeakMap(actual) ||
j$.private.isDataView(actual)
private$.isA('WeakSet', actual) ||
private$.isWeakMap(actual) ||
private$.isDataView(actual)
) {
throw new Error('Cannot get size of ' + actual + '.');
}
let actualSize;
if (j$.private.isSet(actual) || j$.private.isMap(actual)) {
if (private$.isSet(actual) || private$.isMap(actual)) {
actualSize = actual.size;
} else if (isLength(actual.length)) {
actualSize = actual.length;

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toHaveSpyInteractions = function(j$) {
getJasmineRequireObj().toHaveSpyInteractions = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toHaveSpyInteractions>',
'expect(<spyObj>).toHaveSpyInteractions()'
);
@@ -20,7 +20,7 @@ getJasmineRequireObj().toHaveSpyInteractions = function(j$) {
compare: function(actual) {
const result = {};
if (!j$.private.isObject(actual)) {
if (!private$.isObject(actual)) {
throw new Error(
getErrorMsg('Expected a spy object, but got ' + typeof actual + '.')
);

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toMatch = function(j$) {
getJasmineRequireObj().toMatch = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toMatch>',
'expect(<expectation>).toMatch(<string> || <regexp>)'
);
@@ -19,10 +19,7 @@ getJasmineRequireObj().toMatch = function(j$) {
function toMatch() {
return {
compare: function(actual, expected) {
if (
!j$.private.isString(expected) &&
!j$.private.isA('RegExp', expected)
) {
if (!private$.isString(expected) && !private$.isA('RegExp', expected)) {
throw new Error(getErrorMsg('Expected is not a String or a RegExp'));
}

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toThrow = function(j$) {
getJasmineRequireObj().toThrow = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toThrow>',
'expect(function() {<expectation>}).toThrow()'
);

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toThrowError = function(j$) {
getJasmineRequireObj().toThrowError = function(j$, private$) {
'use strict';
const getErrorMsg = j$.private.formatErrorMsg(
const getErrorMsg = private$.formatErrorMsg(
'<toThrowError>',
'expect(function() {<expectation>}).toThrowError(<ErrorConstructor>, <message>)'
);
@@ -38,7 +38,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
thrown = e;
}
if (!j$.private.isError(thrown)) {
if (!private$.isError(thrown)) {
return fail(function() {
return (
'Expected function to throw an Error, but it threw ' +
@@ -81,7 +81,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
match: function(error) {
return pass(
'Expected function not to throw an Error, but it threw ' +
j$.private.fnNameFor(error) +
private$.fnNameFor(error) +
'.'
);
}
@@ -110,12 +110,12 @@ getJasmineRequireObj().toThrowError = function(j$) {
}
const errorTypeDescription = errorType
? j$.private.fnNameFor(errorType)
? private$.fnNameFor(errorType)
: 'an exception';
function thrownDescription(thrown) {
const thrownName = errorType
? j$.private.fnNameFor(thrown.constructor)
? private$.fnNameFor(thrown.constructor)
: 'an exception';
let thrownMessage = '';
@@ -181,7 +181,7 @@ getJasmineRequireObj().toThrowError = function(j$) {
const Surrogate = function() {};
Surrogate.prototype = type.prototype;
return j$.private.isError(new Surrogate());
return private$.isError(new Surrogate());
}
}

View File

@@ -1,7 +1,7 @@
getJasmineRequireObj().toThrowMatching = function(j$) {
getJasmineRequireObj().toThrowMatching = function(j$, private$) {
'use strict';
const usageError = j$.private.formatErrorMsg(
const usageError = private$.formatErrorMsg(
'<toThrowMatching>',
'expect(function() {<expectation>}).toThrowMatching(<Predicate>)'
);
@@ -55,7 +55,7 @@ getJasmineRequireObj().toThrowMatching = function(j$) {
function thrownDescription(thrown) {
if (thrown && thrown.constructor) {
return (
j$.private.fnNameFor(thrown.constructor) +
private$.fnNameFor(thrown.constructor) +
' with message ' +
matchersUtil.pp(thrown.message)
);

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().reporterEvents = function(j$) {
getJasmineRequireObj().reporterEvents = function(j$, private$) {
'use strict';
/**

View File

@@ -1,5 +1,5 @@
// eslint-disable-next-line no-unused-vars,no-var
var getJasmineRequireObj = (function() {
// eslint-disable-next-line no-unused-vars
const getJasmineRequireObj = (function() {
'use strict';
let jasmineRequire;
@@ -12,7 +12,7 @@ var getJasmineRequireObj = (function() {
jasmineRequire = exports;
} else {
// Browser
jasmineRequire = globalThis.jasmineRequire = {};
jasmineRequire = {};
}
function getJasmineRequire() {
@@ -20,88 +20,101 @@ var getJasmineRequireObj = (function() {
}
getJasmineRequire().core = function(jRequire) {
const private$ = {};
const j$ = {};
Object.defineProperty(j$, 'private', {
enumerable: true,
value: {}
});
jRequire.base(j$, globalThis);
j$.private.util = jRequire.util(j$);
j$.private.errors = jRequire.errors();
j$.private.formatErrorMsg = jRequire.formatErrorMsg(j$);
j$.private.AllOf = jRequire.AllOf(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.getStackClearer = jRequire.StackClearer(j$);
j$.private.Clock = jRequire.Clock(j$);
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.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(
jRequire.base(j$, private$, globalThis);
private$.util = jRequire.util(j$, private$);
private$.errors = jRequire.errors();
private$.formatErrorMsg = jRequire.formatErrorMsg(j$, private$);
private$.AllOf = jRequire.AllOf(j$, private$);
private$.Any = jRequire.Any(j$, private$);
private$.Anything = jRequire.Anything(j$, private$);
private$.CallTracker = jRequire.CallTracker(j$, private$);
private$.MockDate = jRequire.MockDate(j$, private$);
private$.getStackClearer = jRequire.StackClearer(j$, private$);
private$.Clock = jRequire.Clock(j$, private$);
private$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(
j$,
private$
);
private$.Deprecator = jRequire.Deprecator(j$, private$);
private$.Configuration = jRequire.Configuration(j$, private$);
private$.Env = jRequire.Env(j$, private$);
private$.StackTrace = jRequire.StackTrace(j$, private$);
private$.ExceptionFormatter = jRequire.ExceptionFormatter(j$, private$);
private$.ExpectationFilterChain = jRequire.ExpectationFilterChain();
private$.Expector = jRequire.Expector(j$, private$);
private$.Expectation = jRequire.Expectation(j$, private$);
private$.buildExpectationResult = jRequire.buildExpectationResult(
j$,
private$
);
private$.makePrettyPrinter = jRequire.makePrettyPrinter(j$, private$);
private$.basicPrettyPrinter = private$.makePrettyPrinter();
private$.MatchersUtil = jRequire.MatchersUtil(j$, private$);
private$.ObjectContaining = jRequire.ObjectContaining(j$, private$);
private$.ArrayContaining = jRequire.ArrayContaining(j$, private$);
private$.ArrayWithExactContents = jRequire.ArrayWithExactContents(
j$,
private$
);
private$.MapContaining = jRequire.MapContaining(j$, private$);
private$.SetContaining = jRequire.SetContaining(j$, private$);
private$.QueueRunner = jRequire.QueueRunner(j$, private$);
private$.NeverSkipPolicy = jRequire.NeverSkipPolicy(j$, private$);
private$.SkipAfterBeforeAllErrorPolicy = jRequire.SkipAfterBeforeAllErrorPolicy(
j$
);
j$.private.CompleteOnFirstErrorSkipPolicy = jRequire.CompleteOnFirstErrorSkipPolicy(
private$.CompleteOnFirstErrorSkipPolicy = jRequire.CompleteOnFirstErrorSkipPolicy(
j$
);
j$.private.reporterEvents = jRequire.reporterEvents(j$);
j$.private.ReportDispatcher = jRequire.ReportDispatcher(j$);
j$.ParallelReportDispatcher = jRequire.ParallelReportDispatcher(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$);
private$.reporterEvents = jRequire.reporterEvents(j$, private$);
private$.ReportDispatcher = jRequire.ReportDispatcher(j$, private$);
j$.ParallelReportDispatcher = jRequire.ParallelReportDispatcher(
j$,
private$
);
private$.CurrentRunableTracker = jRequire.CurrentRunableTracker();
private$.RunableResources = jRequire.RunableResources(j$, private$);
private$.Runner = jRequire.Runner(j$, private$);
private$.Spec = jRequire.Spec(j$, private$);
private$.Spy = jRequire.Spy(j$, private$);
private$.SpyFactory = jRequire.SpyFactory(j$, private$);
private$.SpyRegistry = jRequire.SpyRegistry(j$, private$);
private$.SpyStrategy = jRequire.SpyStrategy(j$, private$);
private$.StringMatching = jRequire.StringMatching(j$, private$);
private$.StringContaining = jRequire.StringContaining(j$, private$);
private$.UserContext = jRequire.UserContext(j$, private$);
private$.Suite = jRequire.Suite(j$, private$);
private$.SuiteBuilder = jRequire.SuiteBuilder(j$, private$);
j$.Timer = jRequire.Timer();
j$.private.TreeProcessor = jRequire.TreeProcessor(j$);
j$.private.TreeRunner = jRequire.TreeRunner(j$);
private$.TreeProcessor = jRequire.TreeProcessor(j$, private$);
private$.TreeRunner = jRequire.TreeRunner(j$, private$);
j$.version = jRequire.version();
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$);
private$.Order = jRequire.Order();
private$.DiffBuilder = jRequire.DiffBuilder(j$, private$);
private$.NullDiffBuilder = jRequire.NullDiffBuilder(j$, private$);
private$.ObjectPath = jRequire.ObjectPath(j$, private$);
private$.MismatchTree = jRequire.MismatchTree(j$, private$);
private$.GlobalErrors = jRequire.GlobalErrors(j$, private$);
private$.Truthy = jRequire.Truthy(j$, private$);
private$.Falsy = jRequire.Falsy(j$, private$);
private$.Empty = jRequire.Empty(j$, private$);
private$.NotEmpty = jRequire.NotEmpty(j$, private$);
private$.Is = jRequire.Is(j$, private$);
j$.private.matchers = jRequire.requireMatchers(jRequire, j$);
j$.private.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$);
private$.matchers = jRequire.requireMatchers(jRequire, j$, private$);
private$.asyncMatchers = jRequire.requireAsyncMatchers(
jRequire,
j$,
private$
);
j$.private.loadedAsBrowserEsm =
private$.loadedAsBrowserEsm =
globalThis.document && !globalThis.document.currentScript;
return j$;
return { jasmine: j$, private: private$ };
};
return getJasmineRequire;

35
src/core/requireSuffix.js Normal file
View File

@@ -0,0 +1,35 @@
(function() {
'use strict';
const isNode = typeof module !== 'undefined' && module.exports;
const jasmineRequire = getJasmineRequireObj();
function bootJasmine(options) {
const jasmine = jasmineRequire.core(jasmineRequire).jasmine;
const env = jasmine.getEnv(options);
const jasmineInterface = jasmineRequire.interface(jasmine, env);
const globals = {
jasmine,
...jasmineInterface
};
return {
jasmine,
globals,
installGlobals(dest) {
dest = dest ?? globalThis;
for (const [k, v] of Object.entries(globals)) {
dest[k] = v;
}
}
};
}
if (isNode) {
module.exports = bootJasmine({ suppressLoadErrors: true });
} else {
// Browser
bootJasmine().installGlobals();
}
})();

View File

@@ -1,4 +1,4 @@
getJasmineRequireObj().util = function(j$) {
getJasmineRequireObj().util = function(j$, private$) {
'use strict';
const util = {};
@@ -29,7 +29,7 @@ getJasmineRequireObj().util = function(j$) {
} else if (str === '[object Date]') {
return new Date(arg.valueOf());
} else {
return j$.private.util.clone(arg);
return private$.util.clone(arg);
}
});
};
@@ -51,7 +51,7 @@ getJasmineRequireObj().util = function(j$) {
};
function callerFile() {
const trace = new j$.private.StackTrace(new Error());
const trace = new private$.StackTrace(new Error());
return trace.frames[1].file;
}

View File

@@ -1,7 +1,7 @@
jasmineRequire.AlertsView = function(j$) {
getJasmineHtmlRequireObj().AlertsView = function(j$, private$) {
'use strict';
const { createDom } = j$.private.htmlReporterUtils;
const { createDom } = private$.htmlReporterUtils;
const errorBarClassName = 'jasmine-bar jasmine-errored';
const afterAllMessagePrefix = 'AfterAll ';

View File

@@ -1,7 +1,7 @@
jasmineRequire.Banner = function(j$) {
getJasmineHtmlRequireObj().Banner = function(j$, private$) {
'use strict';
const { createDom } = j$.private.htmlReporterUtils;
const { createDom } = private$.htmlReporterUtils;
class Banner {
#navigateWithNewParam;

View File

@@ -1,7 +1,7 @@
jasmineRequire.FailuresView = function(j$) {
getJasmineHtmlRequireObj().FailuresView = function(j$, private$) {
'use strict';
const { createDom } = j$.private.htmlReporterUtils;
const { createDom } = private$.htmlReporterUtils;
class FailuresView {
#urlBuilder;

View File

@@ -1,7 +1,7 @@
jasmineRequire.HtmlReporterV2 = function(j$) {
getJasmineHtmlRequireObj().HtmlReporterV2 = function(j$, private$) {
'use strict';
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
const { createDom, noExpectations } = private$.htmlReporterUtils;
const specListTabId = 'jasmine-specListTab';
const failuresTabId = 'jasmine-failuresTab';
@@ -57,14 +57,14 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
this.#config = options.env ? options.env.configuration() : {};
this.#stateBuilder = new j$.private.ResultsStateBuilder();
this.#stateBuilder = new private$.ResultsStateBuilder();
this.#alerts = new j$.private.AlertsView(this.#urlBuilder);
this.#statusBar = new j$.private.OverallStatusBar(this.#urlBuilder);
this.#alerts = new private$.AlertsView(this.#urlBuilder);
this.#statusBar = new private$.OverallStatusBar(this.#urlBuilder);
this.#statusBar.showRunning();
this.#alerts.addBar(this.#statusBar.rootEl);
this.#tabBar = new j$.private.TabBar(
this.#tabBar = new private$.TabBar(
[
{ id: specListTabId, label: 'Spec List' },
{ id: failuresTabId, label: 'Failures' },
@@ -83,11 +83,11 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
this.#alerts.addBar(this.#tabBar.rootEl);
this.#progress = new ProgressView();
this.#banner = new j$.private.Banner(
this.#banner = new private$.Banner(
this.#queryString.navigateWithNewParam.bind(this.#queryString),
true
);
this.#failures = new j$.private.FailuresView(this.#urlBuilder);
this.#failures = new private$.FailuresView(this.#urlBuilder);
this.#htmlReporterMain = createDom(
'div',
{ className: 'jasmine_html-reporter' },
@@ -168,13 +168,13 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
}
const results = this.#find('.jasmine-results');
const summary = new j$.private.SummaryTreeView(
const summary = new private$.SummaryTreeView(
this.#urlBuilder,
this.#filterSpecs
);
summary.addResults(this.#stateBuilder.topResults);
results.appendChild(summary.rootEl);
const perf = new j$.private.PerformanceView();
const perf = new private$.PerformanceView();
perf.addResults(this.#stateBuilder.topResults);
results.appendChild(perf.rootEl);
this.#tabBar.showTab(specListTabId);

View File

@@ -1,4 +1,4 @@
jasmineRequire.HtmlReporterV2Urls = function(j$) {
getJasmineHtmlRequireObj().HtmlReporterV2Urls = function(j$, private$) {
'use strict';
// TODO unify with V2 UrlBuilder?
@@ -49,7 +49,7 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
config.seed = seed;
}
const specFilter = new j$.private.HtmlSpecFilterV2({
const specFilter = new private$.HtmlSpecFilterV2({
filterParams: () => ({
path: this.queryString.getParam('path'),
spec: this.queryString.getParam('spec')

View File

@@ -1,4 +1,4 @@
jasmineRequire.HtmlSpecFilterV2 = function() {
getJasmineHtmlRequireObj().HtmlSpecFilterV2 = function() {
class HtmlSpecFilterV2 {
#getFilterParams;

View File

@@ -1,7 +1,7 @@
jasmineRequire.OverallStatusBar = function(j$) {
getJasmineHtmlRequireObj().OverallStatusBar = function(j$, private$) {
'use strict';
const { createDom } = j$.private.htmlReporterUtils;
const { createDom } = private$.htmlReporterUtils;
const staticClassNames = 'jasmine-overall-result jasmine-bar';
class OverallStatusBar {

View File

@@ -1,5 +1,5 @@
jasmineRequire.PerformanceView = function(j$) {
const createDom = j$.private.htmlReporterUtils.createDom;
getJasmineHtmlRequireObj().PerformanceView = function(j$, private$) {
const createDom = private$.htmlReporterUtils.createDom;
const MAX_SLOW_SPECS = 20;
class PerformanceView {

View File

@@ -1,4 +1,4 @@
jasmineRequire.QueryString = function() {
getJasmineHtmlRequireObj().QueryString = function() {
'use strict';
/**

View File

@@ -1,4 +1,4 @@
jasmineRequire.ResultsNode = function() {
getJasmineHtmlRequireObj().ResultsNode = function() {
'use strict';
function ResultsNode(result, type, parent) {

Some files were not shown because too many files have changed in this diff Show More