diff --git a/.circleci/config.yml b/.circleci/config.yml
index f2ac69ba..7c06d379 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -101,7 +101,7 @@ workflows:
triggers:
- schedule:
# Times are UTC.
- cron: "0 10 * * *"
+ cron: "0 11 * * *"
filters:
branches:
only:
@@ -188,7 +188,7 @@ workflows:
triggers:
- schedule:
# Times are UTC.
- cron: "0 11 * * *"
+ cron: "0 10 * * *"
filters:
branches:
only:
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 5f19cac4..d4986bb6 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -50,9 +50,13 @@ Note that Jasmine tests itself. The files in `lib` are loaded first, defining th
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.
-### `boot.js`
+### `boot0.js` and `boot1.js`
-This file does all of the setup necessary for Jasmine to work. It loads all of the code, creates an `Env`, attaches the global functions, and builds 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.
+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.
### Compatibility
diff --git a/grunt/config/compress.js b/grunt/config/compress.js
index af3d1a5a..d8905113 100644
--- a/grunt/config/compress.js
+++ b/grunt/config/compress.js
@@ -29,7 +29,7 @@ module.exports = {
cwd: libJasmineCore("")
},
{
- src: [ "boot.js" ],
+ src: [ "boot0.js", "boot1.js" ],
dest: standaloneLibDir,
expand: true,
cwd: libJasmineCore("boot")
diff --git a/grunt/config/concat.js b/grunt/config/concat.js
index 07e4b615..098aa2a8 100644
--- a/grunt/config/concat.js
+++ b/grunt/config/concat.js
@@ -41,6 +41,14 @@ module.exports = {
src: ['lib/jasmine-core/boot/boot.js'],
dest: 'lib/jasmine-core/boot.js'
},
+ boot0: {
+ src: ['lib/jasmine-core/boot/boot0.js'],
+ dest: 'lib/jasmine-core/boot0.js'
+ },
+ boot1: {
+ src: ['lib/jasmine-core/boot/boot1.js'],
+ dest: 'lib/jasmine-core/boot1.js'
+ },
nodeBoot: {
src: ['lib/jasmine-core/boot/node_boot.js'],
dest: 'lib/jasmine-core/node_boot.js'
diff --git a/grunt/templates/SpecRunner.html.jst b/grunt/templates/SpecRunner.html.jst
index b10a8d28..23c1d327 100644
--- a/grunt/templates/SpecRunner.html.jst
+++ b/grunt/templates/SpecRunner.html.jst
@@ -9,7 +9,9 @@
-
+
+
+
diff --git a/lib/jasmine-core.js b/lib/jasmine-core.js
index fe0ecd8d..886b7920 100644
--- a/lib/jasmine-core.js
+++ b/lib/jasmine-core.js
@@ -5,11 +5,12 @@ var path = require('path'),
fs = require('fs');
var rootPath = path.join(__dirname, "jasmine-core"),
- bootFiles = ['boot.js'],
+ bootFiles = ['boot0.js', 'boot1.js'],
+ legacyBootFiles = ['boot.js'],
nodeBootFiles = ['node_boot.js'],
cssFiles = [],
jsFiles = [],
- jsFilesToSkip = ['jasmine.js'].concat(bootFiles, nodeBootFiles);
+ jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles, nodeBootFiles);
fs.readdirSync(rootPath).forEach(function(file) {
if(fs.statSync(path.join(rootPath, file)).isFile()) {
diff --git a/lib/jasmine-core.rb b/lib/jasmine-core.rb
index dc8682ec..d540f631 100644
--- a/lib/jasmine-core.rb
+++ b/lib/jasmine-core.rb
@@ -6,7 +6,7 @@ module Jasmine
end
def js_files
- (["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq - boot_files - node_boot_files
+ (["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq - boot_files - ["boot0.js", "boot1.js"] - node_boot_files
end
SPEC_TYPES = ["core", "html", "node"]
diff --git a/lib/jasmine-core/boot.js b/lib/jasmine-core/boot.js
index f03f8527..187e6355 100644
--- a/lib/jasmine-core/boot.js
+++ b/lib/jasmine-core/boot.js
@@ -21,6 +21,10 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
+
+ NOTE: This file is deprecated and will be removed in a future release.
+ Include both boot0.js and boot1.js (in that order) instead.
+
Starting with version 2.0, this file "boots" 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 `jasmine.js` and `jasmine_html.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 a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
@@ -150,4 +154,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
return destination;
}
+ env.deprecated('boot.js is deprecated. Please use boot0.js and boot1.js instead.',
+ { ignoreRunnable: true });
}());
diff --git a/lib/jasmine-core/boot/boot.js b/lib/jasmine-core/boot/boot.js
index ef2b8f7f..c776eb13 100644
--- a/lib/jasmine-core/boot/boot.js
+++ b/lib/jasmine-core/boot/boot.js
@@ -1,4 +1,8 @@
/**
+
+ NOTE: This file is deprecated and will be removed in a future release.
+ Include both boot0.js and boot1.js (in that order) instead.
+
Starting with version 2.0, this file "boots" 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 `jasmine.js` and `jasmine_html.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 a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
@@ -128,4 +132,6 @@
return destination;
}
+ env.deprecated('boot.js is deprecated. Please use boot0.js and boot1.js instead.',
+ { ignoreRunnable: true });
}());
diff --git a/lib/jasmine-core/boot/boot0.js b/lib/jasmine-core/boot/boot0.js
new file mode 100644
index 00000000..ca72e496
--- /dev/null
+++ b/lib/jasmine-core/boot/boot0.js
@@ -0,0 +1,42 @@
+/**
+ 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() {
+ var 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.
+ */
+ var 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.
+ */
+ var 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.
+ */
+ var 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 (var property in jasmineInterface) {
+ global[property] = jasmineInterface[property];
+ }
+}());
diff --git a/lib/jasmine-core/boot/boot1.js b/lib/jasmine-core/boot/boot1.js
new file mode 100644
index 00000000..5df04bb8
--- /dev/null
+++ b/lib/jasmine-core/boot/boot1.js
@@ -0,0 +1,111 @@
+/**
+ 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() {
+ var env = jasmine.getEnv();
+
+ /**
+ * ## Runner Parameters
+ *
+ * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
+ */
+
+ var queryString = new jasmine.QueryString({
+ getWindowLocation: function() { return window.location; }
+ });
+
+ var filterSpecs = !!queryString.getParam("spec");
+
+ var config = {
+ failFast: queryString.getParam("failFast"),
+ oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
+ hideDisabled: queryString.getParam("hideDisabled")
+ };
+
+ var random = queryString.getParam("random");
+
+ if (random !== undefined && random !== "") {
+ config.random = random;
+ }
+
+ var seed = queryString.getParam("seed");
+ if (seed) {
+ config.seed = seed;
+ }
+
+ /**
+ * ## Reporters
+ * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
+ */
+ var htmlReporter = new jasmine.HtmlReporter({
+ env: env,
+ navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
+ addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
+ getContainer: function() { return document.body; },
+ createElement: function() { return document.createElement.apply(document, arguments); },
+ createTextNode: function() { return document.createTextNode.apply(document, arguments); },
+ timer: new jasmine.Timer(),
+ filterSpecs: filterSpecs
+ });
+
+ /**
+ * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
+ */
+ env.addReporter(jsApiReporter);
+ env.addReporter(htmlReporter);
+
+ /**
+ * Filter which specs will be run by matching the start of the full name against the `spec` query param.
+ */
+ var specFilter = new jasmine.HtmlSpecFilter({
+ filterString: function() { return queryString.getParam("spec"); }
+ });
+
+ config.specFilter = function(spec) {
+ return specFilter.matches(spec.getFullName());
+ };
+
+ env.configure(config);
+
+ /**
+ * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
+ */
+ window.setTimeout = window.setTimeout;
+ window.setInterval = window.setInterval;
+ window.clearTimeout = window.clearTimeout;
+ window.clearInterval = window.clearInterval;
+
+ /**
+ * ## Execution
+ *
+ * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
+ */
+ var currentWindowOnload = window.onload;
+
+ window.onload = function() {
+ if (currentWindowOnload) {
+ currentWindowOnload();
+ }
+ htmlReporter.initialize();
+ env.execute();
+ };
+
+ /**
+ * Helper function for readability above.
+ */
+ function extend(destination, source) {
+ for (var property in source) destination[property] = source[property];
+ return destination;
+ }
+
+}());
diff --git a/lib/jasmine-core/boot0.js b/lib/jasmine-core/boot0.js
new file mode 100644
index 00000000..1bfa4193
--- /dev/null
+++ b/lib/jasmine-core/boot0.js
@@ -0,0 +1,64 @@
+/*
+Copyright (c) 2008-2021 Pivotal Labs
+
+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.
+*/
+/**
+ 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() {
+ var 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.
+ */
+ var 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.
+ */
+ var 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.
+ */
+ var 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 (var property in jasmineInterface) {
+ global[property] = jasmineInterface[property];
+ }
+}());
diff --git a/lib/jasmine-core/boot1.js b/lib/jasmine-core/boot1.js
new file mode 100644
index 00000000..6c8748ea
--- /dev/null
+++ b/lib/jasmine-core/boot1.js
@@ -0,0 +1,133 @@
+/*
+Copyright (c) 2008-2021 Pivotal Labs
+
+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.
+*/
+/**
+ 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() {
+ var env = jasmine.getEnv();
+
+ /**
+ * ## Runner Parameters
+ *
+ * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
+ */
+
+ var queryString = new jasmine.QueryString({
+ getWindowLocation: function() { return window.location; }
+ });
+
+ var filterSpecs = !!queryString.getParam("spec");
+
+ var config = {
+ failFast: queryString.getParam("failFast"),
+ oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
+ hideDisabled: queryString.getParam("hideDisabled")
+ };
+
+ var random = queryString.getParam("random");
+
+ if (random !== undefined && random !== "") {
+ config.random = random;
+ }
+
+ var seed = queryString.getParam("seed");
+ if (seed) {
+ config.seed = seed;
+ }
+
+ /**
+ * ## Reporters
+ * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
+ */
+ var htmlReporter = new jasmine.HtmlReporter({
+ env: env,
+ navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
+ addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
+ getContainer: function() { return document.body; },
+ createElement: function() { return document.createElement.apply(document, arguments); },
+ createTextNode: function() { return document.createTextNode.apply(document, arguments); },
+ timer: new jasmine.Timer(),
+ filterSpecs: filterSpecs
+ });
+
+ /**
+ * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
+ */
+ env.addReporter(jsApiReporter);
+ env.addReporter(htmlReporter);
+
+ /**
+ * Filter which specs will be run by matching the start of the full name against the `spec` query param.
+ */
+ var specFilter = new jasmine.HtmlSpecFilter({
+ filterString: function() { return queryString.getParam("spec"); }
+ });
+
+ config.specFilter = function(spec) {
+ return specFilter.matches(spec.getFullName());
+ };
+
+ env.configure(config);
+
+ /**
+ * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
+ */
+ window.setTimeout = window.setTimeout;
+ window.setInterval = window.setInterval;
+ window.clearTimeout = window.clearTimeout;
+ window.clearInterval = window.clearInterval;
+
+ /**
+ * ## Execution
+ *
+ * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
+ */
+ var currentWindowOnload = window.onload;
+
+ window.onload = function() {
+ if (currentWindowOnload) {
+ currentWindowOnload();
+ }
+ htmlReporter.initialize();
+ env.execute();
+ };
+
+ /**
+ * Helper function for readability above.
+ */
+ function extend(destination, source) {
+ for (var property in source) destination[property] = source[property];
+ return destination;
+ }
+
+}());
diff --git a/lib/jasmine-core/core.py b/lib/jasmine-core/core.py
index f58b57cb..936e9b0f 100644
--- a/lib/jasmine-core/core.py
+++ b/lib/jasmine-core/core.py
@@ -58,6 +58,11 @@ class Core(object):
js_files.remove('boot.js')
js_files.append('boot.js')
+ # Remove the new boot files. jasmine-py will continue to use the legacy
+ # boot.js.
+ js_files.remove('boot0.js')
+ js_files.remove('boot1.js')
+
return cls._uniq(js_files)
@classmethod
@@ -86,4 +91,4 @@ class Core(object):
seen[marker] = 1
result.append(item)
- return result
\ No newline at end of file
+ return result
diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js
index d22d0bb4..6870c59b 100644
--- a/lib/jasmine-core/jasmine.js
+++ b/lib/jasmine-core/jasmine.js
@@ -1150,35 +1150,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.
diff --git a/spec/core/EnvSpec.js b/spec/core/EnvSpec.js
index f9bf2911..be10480e 100644
--- a/spec/core/EnvSpec.js
+++ b/spec/core/EnvSpec.js
@@ -111,6 +111,31 @@ describe('Env', function() {
);
});
+ it('ignores configuration properties that are present but undefined', function() {
+ var initialConfig = {
+ random: true,
+ seed: '123',
+ failFast: true,
+ failSpecWithNoExpectations: true,
+ oneFailurePerSpec: true,
+ hideDisabled: true
+ };
+ env.configure(initialConfig);
+
+ env.configure({
+ random: undefined,
+ seed: undefined,
+ failFast: undefined,
+ failSpecWithNoExpectations: undefined,
+ oneFailurePerSpec: undefined,
+ hideDisabled: undefined
+ });
+
+ expect(env.configuration()).toEqual(
+ jasmine.objectContaining(initialConfig)
+ );
+ });
+
describe('promise library', function() {
it('can be configured without a custom library', function() {
env.configure({});
diff --git a/spec/npmPackage/npmPackageSpec.js b/spec/npmPackage/npmPackageSpec.js
index 1d909b72..4e1ec86d 100644
--- a/spec/npmPackage/npmPackageSpec.js
+++ b/spec/npmPackage/npmPackageSpec.js
@@ -74,7 +74,7 @@ describe('npm package', function() {
});
it('has bootFiles', function() {
- expect(this.packagedCore.files.bootFiles).toEqual(['boot.js']);
+ expect(this.packagedCore.files.bootFiles).toEqual(['boot0.js', 'boot1.js']);
expect(this.packagedCore.files.nodeBootFiles).toEqual(['node_boot.js']);
var packagedCore = this.packagedCore;
@@ -82,6 +82,10 @@ describe('npm package', function() {
expect(fileName).toExistInPath(packagedCore.files.bootDir);
});
+ // For backwards compatibility, boot.js should be packaged even though
+ // it is no longer in bootFiles.
+ expect('boot.js').toExistInPath(packagedCore.files.bootDir);
+
var packagedCore = this.packagedCore;
this.packagedCore.files.nodeBootFiles.forEach(function(fileName) {
expect(fileName).toExistInPath(packagedCore.files.bootDir);
diff --git a/src/core/Env.js b/src/core/Env.js
index 6640adfd..5ad08eb8 100644
--- a/src/core/Env.js
+++ b/src/core/Env.js
@@ -182,35 +182,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.