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:
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
@@ -41,13 +41,11 @@ Jasmine tests itself. The files in `lib` are loaded first, defining the referenc
|
||||
|
||||
The tests should always use `jasmineUnderTest` to refer to the objects and functions that are being tested. But the tests can use functions on `jasmine` as needed. _Be careful how you structure any new test code_. Copy the patterns you see in the existing code - this ensures that the code you're testing is not leaking into the `jasmine` reference and vice-versa.
|
||||
|
||||
### `boot0.js` and `boot1.js`
|
||||
### `boot.js`
|
||||
|
||||
These files file does all of the setup necessary for Jasmine to work in a
|
||||
browser. They load all of the code, create an `Env`, attach the global
|
||||
functions, and build the reporter. It also sets up the execution of the
|
||||
`Env` - for browsers this is in `window.onload`. While the default in `lib`
|
||||
is appropriate for browsers, projects may wish to customize this file.
|
||||
This file does all the setup necessary for Jasmine to work in a browser. While
|
||||
the default in `lib`is appropriate for most uses, users may wish to customize
|
||||
this file.
|
||||
|
||||
### Compatibility
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2025 The Jasmine developers
|
||||
Copyright (c) 2008-2026 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -24,70 +24,25 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'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()) {
|
||||
@@ -104,12 +59,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')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2025 The Jasmine developers
|
||||
Copyright (c) 2008-2026 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -24,19 +24,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'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();
|
||||
@@ -49,11 +36,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
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();
|
||||
});
|
||||
};
|
||||
})();
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2025 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
'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 & 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];
|
||||
}
|
||||
})();
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2025 The Jasmine developers
|
||||
Copyright (c) 2008-2026 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
@@ -22,27 +22,44 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-var
|
||||
var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
|
||||
(function() {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const getJasmineHtmlRequireObj = (function() {
|
||||
'use strict';
|
||||
const htmlRequire = {};
|
||||
|
||||
jasmineRequire.html = function(j$) {
|
||||
j$.private.ResultsNode = jasmineRequire.ResultsNode();
|
||||
j$.private.ResultsStateBuilder = jasmineRequire.ResultsStateBuilder(j$);
|
||||
j$.private.htmlReporterUtils = jasmineRequire.htmlReporterUtils(j$);
|
||||
j$.private.AlertsView = jasmineRequire.AlertsView(j$);
|
||||
j$.private.OverallStatusBar = jasmineRequire.OverallStatusBar(j$);
|
||||
j$.private.Banner = jasmineRequire.Banner(j$);
|
||||
j$.private.SummaryTreeView = jasmineRequire.SummaryTreeView(j$);
|
||||
j$.private.FailuresView = jasmineRequire.FailuresView(j$);
|
||||
j$.private.PerformanceView = jasmineRequire.PerformanceView(j$);
|
||||
j$.private.TabBar = jasmineRequire.TabBar(j$);
|
||||
j$.HtmlReporterV2Urls = jasmineRequire.HtmlReporterV2Urls(j$);
|
||||
j$.HtmlReporterV2 = jasmineRequire.HtmlReporterV2(j$);
|
||||
j$.QueryString = jasmineRequire.QueryString();
|
||||
j$.private.HtmlSpecFilterV2 = jasmineRequire.HtmlSpecFilterV2();
|
||||
};
|
||||
function getJasmineHtmlRequire() {
|
||||
return htmlRequire;
|
||||
}
|
||||
|
||||
jasmineRequire.ResultsNode = function() {
|
||||
htmlRequire.html = function(j$, private$) {
|
||||
if (!private$) {
|
||||
private$ = {};
|
||||
}
|
||||
|
||||
private$.ResultsNode = htmlRequire.ResultsNode();
|
||||
private$.ResultsStateBuilder = htmlRequire.ResultsStateBuilder(
|
||||
j$,
|
||||
private$
|
||||
);
|
||||
private$.htmlReporterUtils = htmlRequire.htmlReporterUtils(j$, private$);
|
||||
private$.AlertsView = htmlRequire.AlertsView(j$, private$);
|
||||
private$.OverallStatusBar = htmlRequire.OverallStatusBar(j$, private$);
|
||||
private$.Banner = htmlRequire.Banner(j$, private$);
|
||||
private$.SummaryTreeView = htmlRequire.SummaryTreeView(j$, private$);
|
||||
private$.FailuresView = htmlRequire.FailuresView(j$, private$);
|
||||
private$.PerformanceView = htmlRequire.PerformanceView(j$, private$);
|
||||
private$.TabBar = htmlRequire.TabBar(j$, private$);
|
||||
j$.HtmlReporterV2Urls = htmlRequire.HtmlReporterV2Urls(j$, private$);
|
||||
j$.HtmlReporterV2 = htmlRequire.HtmlReporterV2(j$, private$);
|
||||
j$.QueryString = htmlRequire.QueryString();
|
||||
private$.HtmlSpecFilterV2 = htmlRequire.HtmlSpecFilterV2();
|
||||
};
|
||||
|
||||
return getJasmineHtmlRequire;
|
||||
})();
|
||||
|
||||
getJasmineHtmlRequireObj().ResultsNode = function() {
|
||||
'use strict';
|
||||
|
||||
function ResultsNode(result, type, parent) {
|
||||
@@ -68,7 +85,7 @@ jasmineRequire.ResultsNode = function() {
|
||||
return ResultsNode;
|
||||
};
|
||||
|
||||
jasmineRequire.QueryString = function() {
|
||||
getJasmineHtmlRequireObj().QueryString = function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
@@ -154,10 +171,10 @@ jasmineRequire.QueryString = function() {
|
||||
return QueryString;
|
||||
};
|
||||
|
||||
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 ';
|
||||
|
||||
@@ -273,10 +290,10 @@ jasmineRequire.AlertsView = function(j$) {
|
||||
return AlertsView;
|
||||
};
|
||||
|
||||
jasmineRequire.Banner = function(j$) {
|
||||
getJasmineHtmlRequireObj().Banner = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom } = j$.private.htmlReporterUtils;
|
||||
const { createDom } = private$.htmlReporterUtils;
|
||||
|
||||
class Banner {
|
||||
#navigateWithNewParam;
|
||||
@@ -435,10 +452,10 @@ jasmineRequire.Banner = function(j$) {
|
||||
return Banner;
|
||||
};
|
||||
|
||||
jasmineRequire.FailuresView = function(j$) {
|
||||
getJasmineHtmlRequireObj().FailuresView = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom } = j$.private.htmlReporterUtils;
|
||||
const { createDom } = private$.htmlReporterUtils;
|
||||
|
||||
class FailuresView {
|
||||
#urlBuilder;
|
||||
@@ -602,7 +619,7 @@ jasmineRequire.FailuresView = function(j$) {
|
||||
return FailuresView;
|
||||
};
|
||||
|
||||
jasmineRequire.htmlReporterUtils = function(j$) {
|
||||
getJasmineHtmlRequireObj().htmlReporterUtils = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function createDom(type, attrs, childrenArrayOrVarArgs) {
|
||||
@@ -655,10 +672,10 @@ jasmineRequire.htmlReporterUtils = function(j$) {
|
||||
return { createDom, noExpectations };
|
||||
};
|
||||
|
||||
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';
|
||||
@@ -714,14 +731,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' },
|
||||
@@ -740,11 +757,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' },
|
||||
@@ -825,13 +842,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);
|
||||
@@ -935,7 +952,7 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
||||
return HtmlReporterV2;
|
||||
};
|
||||
|
||||
jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
||||
getJasmineHtmlRequireObj().HtmlReporterV2Urls = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
// TODO unify with V2 UrlBuilder?
|
||||
@@ -986,7 +1003,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')
|
||||
@@ -1008,7 +1025,7 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
||||
return HtmlReporterV2Urls;
|
||||
};
|
||||
|
||||
jasmineRequire.HtmlSpecFilterV2 = function() {
|
||||
getJasmineHtmlRequireObj().HtmlSpecFilterV2 = function() {
|
||||
class HtmlSpecFilterV2 {
|
||||
#getFilterParams;
|
||||
|
||||
@@ -1050,10 +1067,10 @@ jasmineRequire.HtmlSpecFilterV2 = function() {
|
||||
return HtmlSpecFilterV2;
|
||||
};
|
||||
|
||||
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 {
|
||||
@@ -1159,8 +1176,8 @@ jasmineRequire.OverallStatusBar = function(j$) {
|
||||
return OverallStatusBar;
|
||||
};
|
||||
|
||||
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 {
|
||||
@@ -1258,12 +1275,12 @@ jasmineRequire.PerformanceView = function(j$) {
|
||||
return PerformanceView;
|
||||
};
|
||||
|
||||
jasmineRequire.ResultsStateBuilder = function(j$) {
|
||||
getJasmineHtmlRequireObj().ResultsStateBuilder = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
class ResultsStateBuilder {
|
||||
constructor() {
|
||||
this.topResults = new j$.private.ResultsNode({}, '', null);
|
||||
this.topResults = new private$.ResultsNode({}, '', null);
|
||||
this.currentParent = this.topResults;
|
||||
this.suitesById = {};
|
||||
this.totalSpecsDefined = 0;
|
||||
@@ -1341,10 +1358,10 @@ jasmineRequire.ResultsStateBuilder = function(j$) {
|
||||
return ResultsStateBuilder;
|
||||
};
|
||||
|
||||
jasmineRequire.SummaryTreeView = function(j$) {
|
||||
getJasmineHtmlRequireObj().SummaryTreeView = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
|
||||
const { createDom, noExpectations } = private$.htmlReporterUtils;
|
||||
|
||||
class SummaryTreeView {
|
||||
#urlBuilder;
|
||||
@@ -1450,8 +1467,8 @@ jasmineRequire.SummaryTreeView = function(j$) {
|
||||
return SummaryTreeView;
|
||||
};
|
||||
|
||||
jasmineRequire.TabBar = function(j$) {
|
||||
const createDom = j$.private.htmlReporterUtils.createDom;
|
||||
getJasmineHtmlRequireObj().TabBar = function(j$, private$) {
|
||||
const createDom = private$.htmlReporterUtils.createDom;
|
||||
|
||||
class TabBar {
|
||||
#tabs;
|
||||
@@ -1527,3 +1544,10 @@ jasmineRequire.TabBar = function(j$) {
|
||||
|
||||
return TabBar;
|
||||
};
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
getJasmineHtmlRequireObj().html(jasmine);
|
||||
})();
|
||||
|
||||
})()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,9 @@
|
||||
"description": "Simple JavaScript testing framework for browsers and node.js",
|
||||
"homepage": "https://jasmine.github.io",
|
||||
"main": "./lib/jasmine-core.js",
|
||||
"exports": {
|
||||
".": "./lib/jasmine-core.js"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
@@ -45,7 +48,7 @@
|
||||
"eslint-plugin-compat": "^6.0.2",
|
||||
"glob": "^10.2.3",
|
||||
"globals": "^16.0.0",
|
||||
"jasmine": "github:jasmine/jasmine-npm#6.0",
|
||||
"jasmine": "file:../jasmine-npm",
|
||||
"jasmine-browser-runner": "github:jasmine/jasmine-browser-runner#4.0",
|
||||
"jsdom": "^26.0.0",
|
||||
"prettier": "1.17.1",
|
||||
|
||||
@@ -42,8 +42,7 @@ async function zipStandaloneDist(jasmineVersion) {
|
||||
'lib/jasmine-core/jasmine.js',
|
||||
'lib/jasmine-core/jasmine-html.js',
|
||||
'lib/jasmine-core/jasmine.css',
|
||||
'lib/jasmine-core/boot0.js',
|
||||
'lib/jasmine-core/boot1.js',
|
||||
'lib/jasmine-core/boot.js',
|
||||
],
|
||||
destDir: 'lib/jasmine-' + jasmineVersion
|
||||
},
|
||||
|
||||
@@ -34,16 +34,20 @@ function concatFiles() {
|
||||
const configs = [
|
||||
{
|
||||
src: [
|
||||
{ literal: '(function() {' },
|
||||
'src/html/requireHtml.js',
|
||||
'src/html/ResultsNode.js',
|
||||
'src/html/QueryString.js',
|
||||
'src/html/**/*.js'
|
||||
{ glob: 'src/html/**/*.js', exclude: 'src/html/requireSuffix.js' },
|
||||
'src/html/requireSuffix.js',
|
||||
{ literal: '})()' },
|
||||
],
|
||||
dest: 'lib/jasmine-core/jasmine-html.js',
|
||||
},
|
||||
{
|
||||
dest: 'lib/jasmine-core/jasmine.js',
|
||||
src: [
|
||||
{ literal: '(function() {' },
|
||||
'src/core/requireCore.js',
|
||||
'src/core/matchers/requireMatchers.js',
|
||||
'src/core/base.js',
|
||||
@@ -53,20 +57,18 @@ function concatFiles() {
|
||||
'src/core/Env.js',
|
||||
'src/core/PrettyPrinter',
|
||||
'src/core/Suite',
|
||||
'src/core/**/*.js',
|
||||
{ glob: 'src/core/**/*.js', exclude: 'src/core/requireSuffix.js'},
|
||||
{
|
||||
template: 'src/version.js',
|
||||
data: {version: pkg.version}
|
||||
},
|
||||
'src/core/requireSuffix.js',
|
||||
{ literal: '})()' },
|
||||
],
|
||||
},
|
||||
{
|
||||
dest: 'lib/jasmine-core/boot0.js',
|
||||
src: ['src/boot/boot0.js'],
|
||||
},
|
||||
{
|
||||
dest: 'lib/jasmine-core/boot1.js',
|
||||
src: ['src/boot/boot1.js'],
|
||||
dest: 'lib/jasmine-core/boot.js',
|
||||
src: ['src/boot/boot.js'],
|
||||
},
|
||||
{
|
||||
dest: 'lib/jasmine-core.js',
|
||||
@@ -82,25 +84,28 @@ function concatFiles() {
|
||||
src.unshift(licenseBanner);
|
||||
|
||||
function expand(srcListEntry) {
|
||||
if (typeof srcListEntry === 'object') {
|
||||
if (typeof srcListEntry === 'object' && !srcListEntry.glob) {
|
||||
return srcListEntry;
|
||||
}
|
||||
|
||||
return glob.sync(srcListEntry)
|
||||
.sort(function (a, b) {
|
||||
// Match the sort order of previous build tools, so that the
|
||||
// output is the same.
|
||||
a = a.toLowerCase();
|
||||
b = b.toLowerCase();
|
||||
const matches = glob.sync(
|
||||
srcListEntry.glob ?? srcListEntry,
|
||||
{ignore: srcListEntry.exclude}
|
||||
);
|
||||
return matches.sort(function (a, b) {
|
||||
// Match the sort order of previous build tools, so that the
|
||||
// output is the same.
|
||||
a = a.toLowerCase();
|
||||
b = b.toLowerCase();
|
||||
|
||||
if (a < b) {
|
||||
return -1;
|
||||
} else if (a === b) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
if (a < b) {
|
||||
return -1;
|
||||
} else if (a === b) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const srcs = src.flatMap(expand);
|
||||
@@ -114,6 +119,8 @@ function concatFiles() {
|
||||
if (s.template) {
|
||||
const template = fs.readFileSync(s.template, {encoding: 'utf8'});
|
||||
content = ejs.render(template, s.data);
|
||||
} else if (s.literal) {
|
||||
content = s.literal;
|
||||
} else {
|
||||
content = fs.readFileSync(s, {encoding: 'utf8'});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
verifyNoGlobals(() => require('../lib/jasmine-core.js').noGlobals());
|
||||
let jasmineCore;
|
||||
verifyNoGlobals(() => { jasmineCore = require('../lib/jasmine-core.js'); });
|
||||
jasmineCore.installGlobals();
|
||||
|
||||
const Jasmine = require('jasmine');
|
||||
const jasmineCore = require('../lib/jasmine-core.js');
|
||||
const runner = new Jasmine({jasmineCore: jasmineCore});
|
||||
const runner = new Jasmine({jasmineCore});
|
||||
|
||||
runner.loadConfigFile('./spec/support/jasmine.json');
|
||||
runner.exitOnCompletion = false;
|
||||
|
||||
@@ -173,10 +173,13 @@ describe('ExceptionFormatter', function() {
|
||||
});
|
||||
|
||||
it('filters Jasmine stack frames in this environment', function() {
|
||||
const jasmineFile = (function() {
|
||||
const trace = new privateUnderTest.StackTrace(new Error());
|
||||
return trace.frames[2].file;
|
||||
})();
|
||||
expect(jasmineFile).toMatch(/\/jasmine.js$/);
|
||||
const error = new Error('an error');
|
||||
const subject = new privateUnderTest.ExceptionFormatter({
|
||||
jasmineFile: jasmine.private.util.jasmineFile()
|
||||
});
|
||||
const subject = new privateUnderTest.ExceptionFormatter({ jasmineFile });
|
||||
const result = subject.stack(error);
|
||||
jasmine.debugLog('Original stack trace: ' + error.stack);
|
||||
jasmine.debugLog('Filtered stack trace: ' + result);
|
||||
@@ -196,15 +199,18 @@ describe('ExceptionFormatter', function() {
|
||||
});
|
||||
|
||||
it('handles multiline error messages in this environment', function() {
|
||||
const jasmineFile = (function() {
|
||||
const trace = new privateUnderTest.StackTrace(new Error());
|
||||
return trace.frames[2].file;
|
||||
})();
|
||||
expect(jasmineFile).toMatch(/\/jasmine.js$/);
|
||||
const msg = 'an error\nwith two lines';
|
||||
const error = new Error(msg);
|
||||
|
||||
if (error.stack.indexOf(msg) === -1) {
|
||||
pending("Stack traces don't have messages in this environment");
|
||||
}
|
||||
const subject = new privateUnderTest.ExceptionFormatter({
|
||||
jasmineFile: jasmine.private.util.jasmineFile()
|
||||
});
|
||||
const subject = new privateUnderTest.ExceptionFormatter({ jasmineFile });
|
||||
const result = subject.stack(error);
|
||||
const lines = result.split('\n');
|
||||
|
||||
@@ -284,7 +290,7 @@ describe('ExceptionFormatter', function() {
|
||||
it('ensures that stack traces do not include the message in this environment', function() {
|
||||
const error = new Error('an error');
|
||||
const subject = new privateUnderTest.ExceptionFormatter({
|
||||
jasmineFile: jasmine.private.util.jasmineFile()
|
||||
jasmineFile: "doesn't matter"
|
||||
});
|
||||
const result = subject.stack(error, { omitMessage: true });
|
||||
expect(result).not.toContain('an error');
|
||||
|
||||
@@ -278,7 +278,7 @@ describe('Spec', function() {
|
||||
spec.addExpectationResult(true, { message: 'passed' });
|
||||
expect(function() {
|
||||
spec.addExpectationResult(false, { message: 'failed' });
|
||||
}).toThrowError(jasmineUnderTest.private.errors.ExpectationFailed);
|
||||
}).toThrowError(privateUnderTest.errors.ExpectationFailed);
|
||||
|
||||
expect(spec.doneEvent().failedExpectations).toEqual([
|
||||
jasmine.objectContaining({ message: 'failed' })
|
||||
@@ -453,9 +453,7 @@ describe('Spec', function() {
|
||||
queueableFn: {}
|
||||
});
|
||||
|
||||
spec.handleException(
|
||||
new jasmineUnderTest.private.errors.ExpectationFailed()
|
||||
);
|
||||
spec.handleException(new privateUnderTest.errors.ExpectationFailed());
|
||||
|
||||
expect(spec.doneEvent().failedExpectations).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('Suite', function() {
|
||||
|
||||
expect(function() {
|
||||
suite.addExpectationResult(false, { message: 'failed' });
|
||||
}).toThrowError(jasmineUnderTest.private.errors.ExpectationFailed);
|
||||
}).toThrowError(privateUnderTest.errors.ExpectationFailed);
|
||||
|
||||
expect(suite.doneEvent().status).toBe('failed');
|
||||
expect(suite.doneEvent().failedExpectations).toEqual([
|
||||
@@ -149,9 +149,7 @@ describe('Suite', function() {
|
||||
it('does not add an additional failure when an expectation fails', function() {
|
||||
const suite = new privateUnderTest.Suite({});
|
||||
|
||||
suite.handleException(
|
||||
new jasmineUnderTest.private.errors.ExpectationFailed()
|
||||
);
|
||||
suite.handleException(new privateUnderTest.errors.ExpectationFailed());
|
||||
|
||||
expect(suite.doneEvent().failedExpectations).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -163,7 +163,6 @@ describe('util', function() {
|
||||
// Chrome sometimes reports foo.js as foo.js/, so tolerate
|
||||
// a trailing slash if present.
|
||||
expect(privateUnderTest.util.jasmineFile()).toMatch(/util.js\/?$/);
|
||||
expect(jasmine.private.util.jasmineFile()).toMatch(/jasmine.js\/?$/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1289,9 +1289,7 @@ describe('Env integration', function() {
|
||||
await env.execute();
|
||||
expect(reporter.specDone).toHaveBeenCalledTimes(1);
|
||||
const event = reporter.specDone.calls.argsFor(0)[0];
|
||||
jasmine.debugLog(
|
||||
'Spec result: ' + jasmine.private.basicPrettyPrinter(event)
|
||||
);
|
||||
jasmine.debugLog('Spec result: ' + jasmine.pp(event));
|
||||
expect(event).toEqual(jasmine.objectContaining({ status: 'passed' }));
|
||||
jasmine.clock().tick(1);
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ describe('The jasmine namespace', function() {
|
||||
'getEnv',
|
||||
'isSpy',
|
||||
'ParallelReportDispatcher',
|
||||
'private',
|
||||
'spyOnGlobalErrorsAsync',
|
||||
'Timer',
|
||||
'version',
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
(function() {
|
||||
// By the time onload is called, jasmineRequire will be redefined to point
|
||||
// to the Jasmine source files (and not jasmine.js). So re-require
|
||||
window.jasmineUnderTest = jasmineRequire.core(jasmineRequire);
|
||||
jasmineRequire.html(jasmineUnderTest);
|
||||
// By the time onload is called, getJasmineRequireObj() and
|
||||
// getJasmineHtmlRequireObj() will be redefined to point
|
||||
// to the Jasmine source files (and not jasmine.js). So re-require.
|
||||
const jasmineRequire = getJasmineRequireObj();
|
||||
const coreUnderTest = jasmineRequire.core(jasmineRequire);
|
||||
window.jasmineUnderTest = coreUnderTest.jasmine;
|
||||
window.privateUnderTest = coreUnderTest.private;
|
||||
|
||||
// Alias the private namespace so tests can be less verbose
|
||||
window.privateUnderTest = window.jasmineUnderTest.private;
|
||||
getJasmineHtmlRequireObj().html(jasmineUnderTest, privateUnderTest);
|
||||
})();
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
: 'Expected runnable "' +
|
||||
fullName +
|
||||
'" to have failures ' +
|
||||
jasmine.private.basicPrettyPrinter(expectedFailures) +
|
||||
jasmine.pp(expectedFailures) +
|
||||
' but it had ' +
|
||||
jasmine.private.basicPrettyPrinter(foundFailures)
|
||||
jasmine.pp(foundFailures)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,24 +7,29 @@
|
||||
'../../src/core/requireCore.js'
|
||||
));
|
||||
|
||||
// Individual source files call getJasmineRequireObj. It's normally defined
|
||||
// by requireCore.js which is concatenated into jasmine.js before other source
|
||||
// files. Since we're bypassing that mechanism, we need to provide our own.
|
||||
global.getJasmineRequireObj = function() {
|
||||
return jasmineUnderTestRequire;
|
||||
};
|
||||
|
||||
function getSourceFiles() {
|
||||
const globs = ['../../src/core/**/*.js', '../../src/version.js'];
|
||||
const srcFiles = globs.flatMap(g => glob.sync(g, { cwd: __dirname }));
|
||||
const srcFiles = [
|
||||
...glob.sync('../../src/core/**/*.js', {
|
||||
ignore: '../../src/core/requireSuffix.js',
|
||||
cwd: __dirname
|
||||
}),
|
||||
'../../src/version.js',
|
||||
'../../src/core/requireCore.js'
|
||||
];
|
||||
|
||||
for (const file of srcFiles) {
|
||||
require(file);
|
||||
}
|
||||
for (const file of srcFiles) {
|
||||
require(file);
|
||||
}
|
||||
|
||||
getSourceFiles();
|
||||
global.jasmineUnderTest = jasmineUnderTestRequire.core(
|
||||
jasmineUnderTestRequire
|
||||
);
|
||||
delete global.getJasmineRequireObj;
|
||||
|
||||
// Alias the private namespace so tests can be less verbose
|
||||
global.privateUnderTest = global.jasmineUnderTest.private;
|
||||
const built = jasmineUnderTestRequire.core(jasmineUnderTestRequire);
|
||||
global.jasmineUnderTest = built.jasmine;
|
||||
global.privateUnderTest = built.private;
|
||||
})();
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('npm package', function() {
|
||||
});
|
||||
|
||||
it('has bootFiles', function() {
|
||||
expect(this.packagedCore.files.bootFiles).toEqual(['boot0.js', 'boot1.js']);
|
||||
expect(this.packagedCore.files.bootFiles).toEqual(['boot.js']);
|
||||
|
||||
for (const fileName of this.packagedCore.files.bootFiles) {
|
||||
expect(fileName).toExistInPath(this.packagedCore.files.bootDir);
|
||||
|
||||
@@ -12,7 +12,9 @@ module.exports = {
|
||||
'core/**/*.js',
|
||||
'html/**/*.js',
|
||||
'**/*.js',
|
||||
'!boot/**.js'
|
||||
'!boot/**.js',
|
||||
'!core/requireSuffix.js',
|
||||
'!html/requireSuffix.js'
|
||||
],
|
||||
specDir: 'spec',
|
||||
specFiles: ['**/*[Ss]pec.js', '!npmPackage/**/*'],
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
};
|
||||
})();
|
||||
@@ -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 & 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];
|
||||
}
|
||||
})();
|
||||
@@ -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')
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Clock = function(j$) {
|
||||
getJasmineRequireObj().Clock = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
/* global process */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$) {
|
||||
getJasmineRequireObj().CompleteOnFirstErrorSkipPolicy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function CompleteOnFirstErrorSkipPolicy(queueableFns) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Configuration = function(j$) {
|
||||
getJasmineRequireObj().Configuration = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
|
||||
getJasmineRequireObj().DelayedFunctionScheduler = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function DelayedFunctionScheduler() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().MockDate = function(j$) {
|
||||
getJasmineRequireObj().MockDate = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function MockDate(global) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().NeverSkipPolicy = function(j$) {
|
||||
getJasmineRequireObj().NeverSkipPolicy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function NeverSkipPolicy(queueableFns) {}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().ReportDispatcher = function(j$) {
|
||||
getJasmineRequireObj().ReportDispatcher = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function ReportDispatcher(methods, runQueue, onLateError) {
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$) {
|
||||
getJasmineRequireObj().SkipAfterBeforeAllErrorPolicy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function SkipAfterBeforeAllErrorPolicy(queueableFns) {
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().StackClearer = function(j$) {
|
||||
getJasmineRequireObj().StackClearer = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
const maxInlineCallCount = 10;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().StackTrace = function(j$) {
|
||||
getJasmineRequireObj().StackTrace = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function StackTrace(error) {
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().TreeProcessor = function(j$) {
|
||||
getJasmineRequireObj().TreeProcessor = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
const defaultMin = Infinity;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().UserContext = function(j$) {
|
||||
getJasmineRequireObj().UserContext = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function UserContext() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().AllOf = function(j$) {
|
||||
getJasmineRequireObj().AllOf = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function AllOf() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Anything = function(j$) {
|
||||
getJasmineRequireObj().Anything = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Anything() {}
|
||||
|
||||
@@ -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) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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) +
|
||||
'.'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Falsy = function(j$) {
|
||||
getJasmineRequireObj().Falsy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Falsy() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Is = function(j$) {
|
||||
getJasmineRequireObj().Is = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
class Is {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().Truthy = function(j$) {
|
||||
getJasmineRequireObj().Truthy = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
function Truthy() {}
|
||||
|
||||
120
src/core/base.js
120
src/core/base.js
@@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().NullDiffBuilder = function(j$) {
|
||||
getJasmineRequireObj().NullDiffBuilder = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
return function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().ObjectPath = function(j$) {
|
||||
getJasmineRequireObj().ObjectPath = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
class ObjectPath {
|
||||
|
||||
@@ -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}.`
|
||||
);
|
||||
|
||||
@@ -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}.`
|
||||
);
|
||||
|
||||
@@ -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}.`
|
||||
);
|
||||
|
||||
@@ -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))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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}.`
|
||||
);
|
||||
|
||||
@@ -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}.`
|
||||
);
|
||||
|
||||
@@ -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) +
|
||||
'.'
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().toBe = function(j$) {
|
||||
getJasmineRequireObj().toBe = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().toBeNaN = function(j$) {
|
||||
getJasmineRequireObj().toBeNaN = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().toBeNegativeInfinity = function(j$) {
|
||||
getJasmineRequireObj().toBeNegativeInfinity = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
getJasmineRequireObj().toBePositiveInfinity = function(j$) {
|
||||
getJasmineRequireObj().toBePositiveInfinity = function(j$, private$) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
|
||||
@@ -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()'
|
||||
);
|
||||
|
||||
@@ -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>)'
|
||||
);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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.'
|
||||
|
||||
@@ -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 ' +
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user