Split boot.js in two to allow the env to be configured in between

This is mainly intended to support jasmine-browser-runner, which will load
a script that configures the env in between the two boot files (boot0.js and
boot1.js). The single-file boot.js is retained for now but will be removed
in a future release.
This commit is contained in:
Steve Gravrock
2021-07-26 18:00:56 -07:00
parent 2c32dd5703
commit 286524959b
17 changed files with 446 additions and 53 deletions

View File

@@ -170,35 +170,28 @@ getJasmineRequireObj().Env = function(j$) {
* @function
*/
this.configure = function(configuration) {
var booleanProps = [
'random',
'failFast',
'failSpecWithNoExpectations',
'oneFailurePerSpec',
'hideDisabled'
];
booleanProps.forEach(function(prop) {
if (typeof configuration[prop] !== 'undefined') {
config[prop] = !!configuration[prop];
}
});
if (configuration.specFilter) {
config.specFilter = configuration.specFilter;
}
if (configuration.hasOwnProperty('random')) {
config.random = !!configuration.random;
}
if (configuration.hasOwnProperty('seed')) {
if (typeof configuration.seed !== 'undefined') {
config.seed = configuration.seed;
}
if (configuration.hasOwnProperty('failFast')) {
config.failFast = configuration.failFast;
}
if (configuration.hasOwnProperty('failSpecWithNoExpectations')) {
config.failSpecWithNoExpectations =
configuration.failSpecWithNoExpectations;
}
if (configuration.hasOwnProperty('oneFailurePerSpec')) {
config.oneFailurePerSpec = configuration.oneFailurePerSpec;
}
if (configuration.hasOwnProperty('hideDisabled')) {
config.hideDisabled = configuration.hideDisabled;
}
// Don't use hasOwnProperty to check for Promise existence because Promise
// can be initialized to undefined, either explicitly or by using the
// object returned from Env#configuration. In particular, Karma does this.