jasmine-core 3.8.0 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1d57232cc4b128cad1a9e9ddbc94319bd2b56a24211eaae6e32fc1e5c181810
4
- data.tar.gz: ca6ebdb25bc946e9b2abd7e71d22e2cdf22edf33ae86824ab5e7f07d9689cdba
3
+ metadata.gz: f18ca3911368d543ae8408f8b0a3335e4877d5607b7c79d0d294560e6dcc5f71
4
+ data.tar.gz: a4e42a0fa683e962a106f9200e2afce59d58ad3b1610f215e265090de676e2ce
5
5
  SHA512:
6
- metadata.gz: 0d7258d7339350d5bd68e4fa7da1b0170524f74a81c5ca1ca73f919924abde8efa98c1459bda1db2b89ca43973c821e93027ca8a0db720f67241a3aaa7b7c777
7
- data.tar.gz: 61b1a8dfdb8d06916111340bd2a281ca0da8c102385ac5e011a7091d4813f9499928060686c3b92d15d2f6aeaec642f1036fc506f6448b917470b8e601ae070e
6
+ metadata.gz: 7f77c1242debc79d4409c576d2a8463c9e0d4c9582c01b0db6cc9f362aed4cb15356a67b2959f811318d2269b00417e7a1ee5f17f8ac7e2fc8d937b31e57e222
7
+ data.tar.gz: 34af5b076d8b89012961210b1e2dbeff6d7dfd17447deac859df212b7e68d302c108155415b066abd0dae3a1d5962ccb2618c17c27d38890311829847c33fc03
data/lib/jasmine-core.js CHANGED
@@ -5,11 +5,12 @@ var path = require('path'),
5
5
  fs = require('fs');
6
6
 
7
7
  var rootPath = path.join(__dirname, "jasmine-core"),
8
- bootFiles = ['boot.js'],
8
+ bootFiles = ['boot0.js', 'boot1.js'],
9
+ legacyBootFiles = ['boot.js'],
9
10
  nodeBootFiles = ['node_boot.js'],
10
11
  cssFiles = [],
11
12
  jsFiles = [],
12
- jsFilesToSkip = ['jasmine.js'].concat(bootFiles, nodeBootFiles);
13
+ jsFilesToSkip = ['jasmine.js'].concat(bootFiles, legacyBootFiles, nodeBootFiles);
13
14
 
14
15
  fs.readdirSync(rootPath).forEach(function(file) {
15
16
  if(fs.statSync(path.join(rootPath, file)).isFile()) {
data/lib/jasmine-core.rb CHANGED
@@ -6,7 +6,7 @@ module Jasmine
6
6
  end
7
7
 
8
8
  def js_files
9
- (["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq - boot_files - node_boot_files
9
+ (["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq - boot_files - ["boot0.js", "boot1.js"] - node_boot_files
10
10
  end
11
11
 
12
12
  SPEC_TYPES = ["core", "html", "node"]
@@ -21,6 +21,10 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
  /**
24
+
25
+ NOTE: This file is deprecated and will be removed in a future release.
26
+ Include both boot0.js and boot1.js (in that order) instead.
27
+
24
28
  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.
25
29
 
26
30
  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.
@@ -1,4 +1,8 @@
1
1
  /**
2
+
3
+ NOTE: This file is deprecated and will be removed in a future release.
4
+ Include both boot0.js and boot1.js (in that order) instead.
5
+
2
6
  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.
3
7
 
4
8
  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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ This file starts the process of "booting" Jasmine. It initializes Jasmine,
3
+ makes its globals available, and creates the env. This file should be loaded
4
+ after `jasmine.js` and `jasmine_html.js`, but before `boot1.js` or any project
5
+ source files or spec files are loaded.
6
+ */
7
+ (function() {
8
+ var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
9
+
10
+ /**
11
+ * ## Require & Instantiate
12
+ *
13
+ * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
14
+ */
15
+ var jasmine = jasmineRequire.core(jasmineRequire),
16
+ global = jasmine.getGlobal();
17
+ global.jasmine = jasmine;
18
+
19
+ /**
20
+ * 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.
21
+ */
22
+ jasmineRequire.html(jasmine);
23
+
24
+ /**
25
+ * Create the Jasmine environment. This is used to run all specs in a project.
26
+ */
27
+ var env = jasmine.getEnv();
28
+
29
+ /**
30
+ * ## The Global Interface
31
+ *
32
+ * 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.
33
+ */
34
+ var jasmineInterface = jasmineRequire.interface(jasmine, env);
35
+
36
+ /**
37
+ * 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`.
38
+ */
39
+ for (var property in jasmineInterface) {
40
+ global[property] = jasmineInterface[property];
41
+ }
42
+ }());
@@ -0,0 +1,111 @@
1
+ /**
2
+ This file finishes "booting" Jasmine, performing all of the necessary
3
+ initialization before executing the loaded environment and all of a project's
4
+ specs. This file should be loaded after `boot0.js` but before any project
5
+ source files or spec files are loaded. Thus this file can also be used to
6
+ customize Jasmine for a project.
7
+
8
+ If a project is using Jasmine via the standalone distribution, this file can
9
+ be customized directly. If you only wish to configure the Jasmine env, you
10
+ can load another file that calls `jasmine.getEnv().configure({...})`
11
+ after `boot0.js` is loaded and before this file is loaded.
12
+ */
13
+
14
+ (function() {
15
+ var env = jasmine.getEnv();
16
+
17
+ /**
18
+ * ## Runner Parameters
19
+ *
20
+ * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
21
+ */
22
+
23
+ var queryString = new jasmine.QueryString({
24
+ getWindowLocation: function() { return window.location; }
25
+ });
26
+
27
+ var filterSpecs = !!queryString.getParam("spec");
28
+
29
+ var config = {
30
+ failFast: queryString.getParam("failFast"),
31
+ oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
32
+ hideDisabled: queryString.getParam("hideDisabled")
33
+ };
34
+
35
+ var random = queryString.getParam("random");
36
+
37
+ if (random !== undefined && random !== "") {
38
+ config.random = random;
39
+ }
40
+
41
+ var seed = queryString.getParam("seed");
42
+ if (seed) {
43
+ config.seed = seed;
44
+ }
45
+
46
+ /**
47
+ * ## Reporters
48
+ * 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).
49
+ */
50
+ var htmlReporter = new jasmine.HtmlReporter({
51
+ env: env,
52
+ navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
53
+ addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
54
+ getContainer: function() { return document.body; },
55
+ createElement: function() { return document.createElement.apply(document, arguments); },
56
+ createTextNode: function() { return document.createTextNode.apply(document, arguments); },
57
+ timer: new jasmine.Timer(),
58
+ filterSpecs: filterSpecs
59
+ });
60
+
61
+ /**
62
+ * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
63
+ */
64
+ env.addReporter(jsApiReporter);
65
+ env.addReporter(htmlReporter);
66
+
67
+ /**
68
+ * Filter which specs will be run by matching the start of the full name against the `spec` query param.
69
+ */
70
+ var specFilter = new jasmine.HtmlSpecFilter({
71
+ filterString: function() { return queryString.getParam("spec"); }
72
+ });
73
+
74
+ config.specFilter = function(spec) {
75
+ return specFilter.matches(spec.getFullName());
76
+ };
77
+
78
+ env.configure(config);
79
+
80
+ /**
81
+ * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
82
+ */
83
+ window.setTimeout = window.setTimeout;
84
+ window.setInterval = window.setInterval;
85
+ window.clearTimeout = window.clearTimeout;
86
+ window.clearInterval = window.clearInterval;
87
+
88
+ /**
89
+ * ## Execution
90
+ *
91
+ * 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.
92
+ */
93
+ var currentWindowOnload = window.onload;
94
+
95
+ window.onload = function() {
96
+ if (currentWindowOnload) {
97
+ currentWindowOnload();
98
+ }
99
+ htmlReporter.initialize();
100
+ env.execute();
101
+ };
102
+
103
+ /**
104
+ * Helper function for readability above.
105
+ */
106
+ function extend(destination, source) {
107
+ for (var property in source) destination[property] = source[property];
108
+ return destination;
109
+ }
110
+
111
+ }());
@@ -0,0 +1,64 @@
1
+ /*
2
+ Copyright (c) 2008-2021 Pivotal Labs
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+ /**
24
+ This file starts the process of "booting" Jasmine. It initializes Jasmine,
25
+ makes its globals available, and creates the env. This file should be loaded
26
+ after `jasmine.js` and `jasmine_html.js`, but before `boot1.js` or any project
27
+ source files or spec files are loaded.
28
+ */
29
+ (function() {
30
+ var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
31
+
32
+ /**
33
+ * ## Require & Instantiate
34
+ *
35
+ * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
36
+ */
37
+ var jasmine = jasmineRequire.core(jasmineRequire),
38
+ global = jasmine.getGlobal();
39
+ global.jasmine = jasmine;
40
+
41
+ /**
42
+ * 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.
43
+ */
44
+ jasmineRequire.html(jasmine);
45
+
46
+ /**
47
+ * Create the Jasmine environment. This is used to run all specs in a project.
48
+ */
49
+ var env = jasmine.getEnv();
50
+
51
+ /**
52
+ * ## The Global Interface
53
+ *
54
+ * 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.
55
+ */
56
+ var jasmineInterface = jasmineRequire.interface(jasmine, env);
57
+
58
+ /**
59
+ * 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`.
60
+ */
61
+ for (var property in jasmineInterface) {
62
+ global[property] = jasmineInterface[property];
63
+ }
64
+ }());
@@ -0,0 +1,133 @@
1
+ /*
2
+ Copyright (c) 2008-2021 Pivotal Labs
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+ /**
24
+ This file finishes "booting" Jasmine, performing all of the necessary
25
+ initialization before executing the loaded environment and all of a project's
26
+ specs. This file should be loaded after `boot0.js` but before any project
27
+ source files or spec files are loaded. Thus this file can also be used to
28
+ customize Jasmine for a project.
29
+
30
+ If a project is using Jasmine via the standalone distribution, this file can
31
+ be customized directly. If you only wish to configure the Jasmine env, you
32
+ can load another file that calls `jasmine.getEnv().configure({...})`
33
+ after `boot0.js` is loaded and before this file is loaded.
34
+ */
35
+
36
+ (function() {
37
+ var env = jasmine.getEnv();
38
+
39
+ /**
40
+ * ## Runner Parameters
41
+ *
42
+ * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
43
+ */
44
+
45
+ var queryString = new jasmine.QueryString({
46
+ getWindowLocation: function() { return window.location; }
47
+ });
48
+
49
+ var filterSpecs = !!queryString.getParam("spec");
50
+
51
+ var config = {
52
+ failFast: queryString.getParam("failFast"),
53
+ oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
54
+ hideDisabled: queryString.getParam("hideDisabled")
55
+ };
56
+
57
+ var random = queryString.getParam("random");
58
+
59
+ if (random !== undefined && random !== "") {
60
+ config.random = random;
61
+ }
62
+
63
+ var seed = queryString.getParam("seed");
64
+ if (seed) {
65
+ config.seed = seed;
66
+ }
67
+
68
+ /**
69
+ * ## Reporters
70
+ * 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).
71
+ */
72
+ var htmlReporter = new jasmine.HtmlReporter({
73
+ env: env,
74
+ navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
75
+ addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
76
+ getContainer: function() { return document.body; },
77
+ createElement: function() { return document.createElement.apply(document, arguments); },
78
+ createTextNode: function() { return document.createTextNode.apply(document, arguments); },
79
+ timer: new jasmine.Timer(),
80
+ filterSpecs: filterSpecs
81
+ });
82
+
83
+ /**
84
+ * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
85
+ */
86
+ env.addReporter(jsApiReporter);
87
+ env.addReporter(htmlReporter);
88
+
89
+ /**
90
+ * Filter which specs will be run by matching the start of the full name against the `spec` query param.
91
+ */
92
+ var specFilter = new jasmine.HtmlSpecFilter({
93
+ filterString: function() { return queryString.getParam("spec"); }
94
+ });
95
+
96
+ config.specFilter = function(spec) {
97
+ return specFilter.matches(spec.getFullName());
98
+ };
99
+
100
+ env.configure(config);
101
+
102
+ /**
103
+ * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
104
+ */
105
+ window.setTimeout = window.setTimeout;
106
+ window.setInterval = window.setInterval;
107
+ window.clearTimeout = window.clearTimeout;
108
+ window.clearInterval = window.clearInterval;
109
+
110
+ /**
111
+ * ## Execution
112
+ *
113
+ * 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.
114
+ */
115
+ var currentWindowOnload = window.onload;
116
+
117
+ window.onload = function() {
118
+ if (currentWindowOnload) {
119
+ currentWindowOnload();
120
+ }
121
+ htmlReporter.initialize();
122
+ env.execute();
123
+ };
124
+
125
+ /**
126
+ * Helper function for readability above.
127
+ */
128
+ function extend(destination, source) {
129
+ for (var property in source) destination[property] = source[property];
130
+ return destination;
131
+ }
132
+
133
+ }());
@@ -58,6 +58,11 @@ class Core(object):
58
58
  js_files.remove('boot.js')
59
59
  js_files.append('boot.js')
60
60
 
61
+ # Remove the new boot files. jasmine-py will continue to use the legacy
62
+ # boot.js.
63
+ js_files.remove('boot0.js')
64
+ js_files.remove('boot1.js')
65
+
61
66
  return cls._uniq(js_files)
62
67
 
63
68
  @classmethod
@@ -86,4 +91,4 @@ class Core(object):
86
91
 
87
92
  seen[marker] = 1
88
93
  result.append(item)
89
- return result
94
+ return result
@@ -558,17 +558,20 @@ jasmineRequire.HtmlReporter = function(j$) {
558
558
  );
559
559
 
560
560
  var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
561
- failFastCheckbox.checked = config.failFast;
561
+ failFastCheckbox.checked = config.stopOnSpecFailure;
562
562
  failFastCheckbox.onclick = function() {
563
- navigateWithNewParam('failFast', !config.failFast);
563
+ navigateWithNewParam('failFast', !config.stopOnSpecFailure);
564
564
  };
565
565
 
566
566
  var throwCheckbox = optionsMenuDom.querySelector(
567
567
  '#jasmine-throw-failures'
568
568
  );
569
- throwCheckbox.checked = config.oneFailurePerSpec;
569
+ throwCheckbox.checked = config.stopSpecOnExpectationFailure;
570
570
  throwCheckbox.onclick = function() {
571
- navigateWithNewParam('oneFailurePerSpec', !config.oneFailurePerSpec);
571
+ navigateWithNewParam(
572
+ 'oneFailurePerSpec',
573
+ !config.stopSpecOnExpectationFailure
574
+ );
572
575
  };
573
576
 
574
577
  var randomCheckbox = optionsMenuDom.querySelector(
@@ -267,9 +267,21 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
267
267
  };
268
268
 
269
269
  j$.isError_ = function(value) {
270
+ if (!value) {
271
+ return false;
272
+ }
273
+
270
274
  if (value instanceof Error) {
271
275
  return true;
272
276
  }
277
+ if (
278
+ typeof window !== 'undefined' &&
279
+ typeof window.trustedTypes !== 'undefined'
280
+ ) {
281
+ return (
282
+ typeof value.stack === 'string' && typeof value.message === 'string'
283
+ );
284
+ }
273
285
  if (value && value.constructor && value.constructor.constructor) {
274
286
  var valueGlobal = value.constructor.constructor('return this');
275
287
  if (j$.isFunction_(valueGlobal)) {
@@ -700,6 +712,12 @@ getJasmineRequireObj().Spec = function(j$) {
700
712
  this.expectationFactory = attrs.expectationFactory;
701
713
  this.asyncExpectationFactory = attrs.asyncExpectationFactory;
702
714
  this.resultCallback = attrs.resultCallback || function() {};
715
+ /**
716
+ * The unique ID of this spec.
717
+ * @name Spec#id
718
+ * @readonly
719
+ * @type {string}
720
+ */
703
721
  this.id = attrs.id;
704
722
  /**
705
723
  * The description passed to the {@link it} that created this spec.
@@ -1057,8 +1075,17 @@ getJasmineRequireObj().Env = function(j$) {
1057
1075
  * @since 3.3.0
1058
1076
  * @type Boolean
1059
1077
  * @default false
1078
+ * @deprecated Use the `stopOnSpecFailure` config property instead.
1060
1079
  */
1061
1080
  failFast: false,
1081
+ /**
1082
+ * Whether to stop execution of the suite after the first spec failure
1083
+ * @name Configuration#stopOnSpecFailure
1084
+ * @since 3.9.0
1085
+ * @type Boolean
1086
+ * @default false
1087
+ */
1088
+ stopOnSpecFailure: false,
1062
1089
  /**
1063
1090
  * Whether to fail the spec if it ran no expectations. By default
1064
1091
  * a spec that ran no expectations is reported as passed. Setting this
@@ -1075,8 +1102,17 @@ getJasmineRequireObj().Env = function(j$) {
1075
1102
  * @since 3.3.0
1076
1103
  * @type Boolean
1077
1104
  * @default false
1105
+ * @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
1078
1106
  */
1079
1107
  oneFailurePerSpec: false,
1108
+ /**
1109
+ * Whether to cause specs to only have one expectation failure.
1110
+ * @name Configuration#stopSpecOnExpectationFailure
1111
+ * @since 3.3.0
1112
+ * @type Boolean
1113
+ * @default false
1114
+ */
1115
+ stopSpecOnExpectationFailure: false,
1080
1116
  /**
1081
1117
  * A function that takes a spec and returns true if it should be executed
1082
1118
  * or false if it should be skipped.
@@ -1162,33 +1198,64 @@ getJasmineRequireObj().Env = function(j$) {
1162
1198
  * @function
1163
1199
  */
1164
1200
  this.configure = function(configuration) {
1165
- if (configuration.specFilter) {
1166
- config.specFilter = configuration.specFilter;
1167
- }
1168
-
1169
- if (configuration.hasOwnProperty('random')) {
1170
- config.random = !!configuration.random;
1171
- }
1201
+ var booleanProps = [
1202
+ 'random',
1203
+ 'failSpecWithNoExpectations',
1204
+ 'hideDisabled'
1205
+ ];
1206
+
1207
+ booleanProps.forEach(function(prop) {
1208
+ if (typeof configuration[prop] !== 'undefined') {
1209
+ config[prop] = !!configuration[prop];
1210
+ }
1211
+ });
1172
1212
 
1173
- if (configuration.hasOwnProperty('seed')) {
1174
- config.seed = configuration.seed;
1175
- }
1213
+ if (typeof configuration.failFast !== 'undefined') {
1214
+ if (typeof configuration.stopOnSpecFailure !== 'undefined') {
1215
+ if (configuration.stopOnSpecFailure !== configuration.failFast) {
1216
+ throw new Error(
1217
+ 'stopOnSpecFailure and failFast are aliases for ' +
1218
+ "each other. Don't set failFast if you also set stopOnSpecFailure."
1219
+ );
1220
+ }
1221
+ }
1176
1222
 
1177
- if (configuration.hasOwnProperty('failFast')) {
1178
1223
  config.failFast = configuration.failFast;
1224
+ config.stopOnSpecFailure = configuration.failFast;
1225
+ } else if (typeof configuration.stopOnSpecFailure !== 'undefined') {
1226
+ config.failFast = configuration.stopOnSpecFailure;
1227
+ config.stopOnSpecFailure = configuration.stopOnSpecFailure;
1179
1228
  }
1180
1229
 
1181
- if (configuration.hasOwnProperty('failSpecWithNoExpectations')) {
1182
- config.failSpecWithNoExpectations =
1183
- configuration.failSpecWithNoExpectations;
1184
- }
1230
+ if (typeof configuration.oneFailurePerSpec !== 'undefined') {
1231
+ if (typeof configuration.stopSpecOnExpectationFailure !== 'undefined') {
1232
+ if (
1233
+ configuration.stopSpecOnExpectationFailure !==
1234
+ configuration.oneFailurePerSpec
1235
+ ) {
1236
+ throw new Error(
1237
+ 'stopSpecOnExpectationFailure and oneFailurePerSpec are aliases for ' +
1238
+ "each other. Don't set oneFailurePerSpec if you also set stopSpecOnExpectationFailure."
1239
+ );
1240
+ }
1241
+ }
1185
1242
 
1186
- if (configuration.hasOwnProperty('oneFailurePerSpec')) {
1187
1243
  config.oneFailurePerSpec = configuration.oneFailurePerSpec;
1244
+ config.stopSpecOnExpectationFailure = configuration.oneFailurePerSpec;
1245
+ } else if (
1246
+ typeof configuration.stopSpecOnExpectationFailure !== 'undefined'
1247
+ ) {
1248
+ config.oneFailurePerSpec = configuration.stopSpecOnExpectationFailure;
1249
+ config.stopSpecOnExpectationFailure =
1250
+ configuration.stopSpecOnExpectationFailure;
1188
1251
  }
1189
1252
 
1190
- if (configuration.hasOwnProperty('hideDisabled')) {
1191
- config.hideDisabled = configuration.hideDisabled;
1253
+ if (configuration.specFilter) {
1254
+ config.specFilter = configuration.specFilter;
1255
+ }
1256
+
1257
+ if (typeof configuration.seed !== 'undefined') {
1258
+ config.seed = configuration.seed;
1192
1259
  }
1193
1260
 
1194
1261
  // Don't use hasOwnProperty to check for Promise existence because Promise
@@ -1486,18 +1553,22 @@ getJasmineRequireObj().Env = function(j$) {
1486
1553
  * @since 2.3.0
1487
1554
  * @function
1488
1555
  * @param {Boolean} value Whether to throw when a expectation fails
1489
- * @deprecated Use the `oneFailurePerSpec` option with {@link Env#configure}
1556
+ * @deprecated Use the `stopSpecOnExpectationFailure` option with {@link Env#configure}
1490
1557
  */
1491
1558
  this.throwOnExpectationFailure = function(value) {
1492
1559
  this.deprecated(
1493
- 'Setting throwOnExpectationFailure directly on Env is deprecated and will be removed in a future version of Jasmine, please use the oneFailurePerSpec option in `configure`'
1560
+ 'Setting throwOnExpectationFailure directly on Env is deprecated and ' +
1561
+ 'will be removed in a future version of Jasmine. Please use the ' +
1562
+ 'stopSpecOnExpectationFailure option in `configure`.'
1494
1563
  );
1495
1564
  this.configure({ oneFailurePerSpec: !!value });
1496
1565
  };
1497
1566
 
1498
1567
  this.throwingExpectationFailures = function() {
1499
1568
  this.deprecated(
1500
- 'Getting throwingExpectationFailures directly from Env is deprecated and will be removed in a future version of Jasmine, please check the oneFailurePerSpec option from `configuration`'
1569
+ 'Getting throwingExpectationFailures directly from Env is deprecated ' +
1570
+ 'and will be removed in a future version of Jasmine. Please check ' +
1571
+ 'the stopSpecOnExpectationFailure option from `configuration`.'
1501
1572
  );
1502
1573
  return config.oneFailurePerSpec;
1503
1574
  };
@@ -1508,18 +1579,22 @@ getJasmineRequireObj().Env = function(j$) {
1508
1579
  * @since 2.7.0
1509
1580
  * @function
1510
1581
  * @param {Boolean} value Whether to stop suite execution when a spec fails
1511
- * @deprecated Use the `failFast` option with {@link Env#configure}
1582
+ * @deprecated Use the `stopOnSpecFailure` option with {@link Env#configure}
1512
1583
  */
1513
1584
  this.stopOnSpecFailure = function(value) {
1514
1585
  this.deprecated(
1515
- 'Setting stopOnSpecFailure directly is deprecated and will be removed in a future version of Jasmine, please use the failFast option in `configure`'
1586
+ 'Setting stopOnSpecFailure directly is deprecated and will be ' +
1587
+ 'removed in a future version of Jasmine. Please use the ' +
1588
+ 'stopOnSpecFailure option in `configure`.'
1516
1589
  );
1517
- this.configure({ failFast: !!value });
1590
+ this.configure({ stopOnSpecFailure: !!value });
1518
1591
  };
1519
1592
 
1520
1593
  this.stoppingOnSpecFailure = function() {
1521
1594
  this.deprecated(
1522
- 'Getting stoppingOnSpecFailure directly from Env is deprecated and will be removed in a future version of Jasmine, please check the failFast option from `configuration`'
1595
+ 'Getting stoppingOnSpecFailure directly from Env is deprecated and ' +
1596
+ 'will be removed in a future version of Jasmine. Please check the ' +
1597
+ 'stopOnSpecFailure option from `configuration`.'
1523
1598
  );
1524
1599
  return config.failFast;
1525
1600
  };
@@ -1575,6 +1650,7 @@ getJasmineRequireObj().Env = function(j$) {
1575
1650
  * @name Env#hideDisabled
1576
1651
  * @since 3.2.0
1577
1652
  * @function
1653
+ * @deprecated Use the `hideDisabled` option with {@link Env#configure}
1578
1654
  */
1579
1655
  this.hideDisabled = function(value) {
1580
1656
  this.deprecated(
@@ -1607,9 +1683,9 @@ getJasmineRequireObj().Env = function(j$) {
1607
1683
  var queueRunnerFactory = function(options, args) {
1608
1684
  var failFast = false;
1609
1685
  if (options.isLeaf) {
1610
- failFast = config.oneFailurePerSpec;
1686
+ failFast = config.stopSpecOnExpectationFailure;
1611
1687
  } else if (!options.isReporter) {
1612
- failFast = config.failFast;
1688
+ failFast = config.stopOnSpecFailure;
1613
1689
  }
1614
1690
  options.clearStack = options.clearStack || clearStack;
1615
1691
  options.timeout = {
@@ -1741,11 +1817,17 @@ getJasmineRequireObj().Env = function(j$) {
1741
1817
  *
1742
1818
  * execute should not be called more than once.
1743
1819
  *
1820
+ * If the environment supports promises, execute will return a promise that
1821
+ * is resolved after the suite finishes executing. The promise will be
1822
+ * resolved (not rejected) as long as the suite runs to completion. Use a
1823
+ * {@link Reporter} to determine whether or not the suite passed.
1824
+ *
1744
1825
  * @name Env#execute
1745
1826
  * @since 2.0.0
1746
1827
  * @function
1747
1828
  * @param {(string[])=} runnablesToRun IDs of suites and/or specs to run
1748
1829
  * @param {Function=} onComplete Function that will be called after all specs have run
1830
+ * @return {Promise<undefined>}
1749
1831
  */
1750
1832
  this.execute = function(runnablesToRun, onComplete) {
1751
1833
  installGlobalErrors();
@@ -1805,65 +1887,86 @@ getJasmineRequireObj().Env = function(j$) {
1805
1887
  var jasmineTimer = new j$.Timer();
1806
1888
  jasmineTimer.start();
1807
1889
 
1808
- /**
1809
- * Information passed to the {@link Reporter#jasmineStarted} event.
1810
- * @typedef JasmineStartedInfo
1811
- * @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
1812
- * @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
1813
- */
1814
- reporter.jasmineStarted(
1815
- {
1816
- totalSpecsDefined: totalSpecsDefined,
1817
- order: order
1818
- },
1819
- function() {
1820
- currentlyExecutingSuites.push(topSuite);
1821
-
1822
- processor.execute(function() {
1823
- clearResourcesForRunnable(topSuite.id);
1824
- currentlyExecutingSuites.pop();
1825
- var overallStatus, incompleteReason;
1826
-
1827
- if (hasFailures || topSuite.result.failedExpectations.length > 0) {
1828
- overallStatus = 'failed';
1829
- } else if (focusedRunnables.length > 0) {
1830
- overallStatus = 'incomplete';
1831
- incompleteReason = 'fit() or fdescribe() was found';
1832
- } else if (totalSpecsDefined === 0) {
1833
- overallStatus = 'incomplete';
1834
- incompleteReason = 'No specs found';
1835
- } else {
1836
- overallStatus = 'passed';
1890
+ var Promise = customPromise || global.Promise;
1891
+
1892
+ if (Promise) {
1893
+ return new Promise(function(resolve) {
1894
+ runAll(function() {
1895
+ if (onComplete) {
1896
+ onComplete();
1837
1897
  }
1838
1898
 
1839
- /**
1840
- * Information passed to the {@link Reporter#jasmineDone} event.
1841
- * @typedef JasmineDoneInfo
1842
- * @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
1843
- * @property {Int} totalTime - The total time (in ms) that it took to execute the suite
1844
- * @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
1845
- * @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
1846
- * @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
1847
- * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
1848
- */
1849
- reporter.jasmineDone(
1850
- {
1851
- overallStatus: overallStatus,
1852
- totalTime: jasmineTimer.elapsed(),
1853
- incompleteReason: incompleteReason,
1854
- order: order,
1855
- failedExpectations: topSuite.result.failedExpectations,
1856
- deprecationWarnings: topSuite.result.deprecationWarnings
1857
- },
1858
- function() {
1859
- if (onComplete) {
1860
- onComplete();
1861
- }
1862
- }
1863
- );
1899
+ resolve();
1864
1900
  });
1865
- }
1866
- );
1901
+ });
1902
+ } else {
1903
+ runAll(function() {
1904
+ if (onComplete) {
1905
+ onComplete();
1906
+ }
1907
+ });
1908
+ }
1909
+
1910
+ function runAll(done) {
1911
+ /**
1912
+ * Information passed to the {@link Reporter#jasmineStarted} event.
1913
+ * @typedef JasmineStartedInfo
1914
+ * @property {Int} totalSpecsDefined - The total number of specs defined in this suite.
1915
+ * @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
1916
+ */
1917
+ reporter.jasmineStarted(
1918
+ {
1919
+ totalSpecsDefined: totalSpecsDefined,
1920
+ order: order
1921
+ },
1922
+ function() {
1923
+ currentlyExecutingSuites.push(topSuite);
1924
+
1925
+ processor.execute(function() {
1926
+ clearResourcesForRunnable(topSuite.id);
1927
+ currentlyExecutingSuites.pop();
1928
+ var overallStatus, incompleteReason;
1929
+
1930
+ if (
1931
+ hasFailures ||
1932
+ topSuite.result.failedExpectations.length > 0
1933
+ ) {
1934
+ overallStatus = 'failed';
1935
+ } else if (focusedRunnables.length > 0) {
1936
+ overallStatus = 'incomplete';
1937
+ incompleteReason = 'fit() or fdescribe() was found';
1938
+ } else if (totalSpecsDefined === 0) {
1939
+ overallStatus = 'incomplete';
1940
+ incompleteReason = 'No specs found';
1941
+ } else {
1942
+ overallStatus = 'passed';
1943
+ }
1944
+
1945
+ /**
1946
+ * Information passed to the {@link Reporter#jasmineDone} event.
1947
+ * @typedef JasmineDoneInfo
1948
+ * @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'.
1949
+ * @property {Int} totalTime - The total time (in ms) that it took to execute the suite
1950
+ * @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete.
1951
+ * @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
1952
+ * @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
1953
+ * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
1954
+ */
1955
+ reporter.jasmineDone(
1956
+ {
1957
+ overallStatus: overallStatus,
1958
+ totalTime: jasmineTimer.elapsed(),
1959
+ incompleteReason: incompleteReason,
1960
+ order: order,
1961
+ failedExpectations: topSuite.result.failedExpectations,
1962
+ deprecationWarnings: topSuite.result.deprecationWarnings
1963
+ },
1964
+ done
1965
+ );
1966
+ });
1967
+ }
1968
+ );
1969
+ }
1867
1970
  };
1868
1971
 
1869
1972
  /**
@@ -4230,16 +4333,22 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
4230
4333
  function taggedOnError(error) {
4231
4334
  var substituteMsg;
4232
4335
 
4233
- if (error) {
4336
+ if (j$.isError_(error)) {
4234
4337
  error.jasmineMessage = jasmineMessage + ': ' + error;
4235
4338
  } else {
4236
- substituteMsg = jasmineMessage + ' with no error or message';
4339
+ if (error) {
4340
+ substituteMsg = jasmineMessage + ': ' + error;
4341
+ } else {
4342
+ substituteMsg = jasmineMessage + ' with no error or message';
4343
+ }
4237
4344
 
4238
4345
  if (errorType === 'unhandledRejection') {
4239
4346
  substituteMsg +=
4240
4347
  '\n' +
4241
4348
  '(Tip: to get a useful stack trace, use ' +
4242
- 'Promise.reject(new Error(...)) instead of Promise.reject().)';
4349
+ 'Promise.reject(new Error(...)) instead of Promise.reject(' +
4350
+ (error ? '...' : '') +
4351
+ ').)';
4243
4352
  }
4244
4353
 
4245
4354
  error = new Error(substituteMsg);
@@ -9236,6 +9345,12 @@ getJasmineRequireObj().Suite = function(j$) {
9236
9345
  */
9237
9346
  function Suite(attrs) {
9238
9347
  this.env = attrs.env;
9348
+ /**
9349
+ * The unique ID of this suite.
9350
+ * @name Suite#id
9351
+ * @readonly
9352
+ * @type {string}
9353
+ */
9239
9354
  this.id = attrs.id;
9240
9355
  /**
9241
9356
  * The parent of this suite, or null if this is the top suite.
@@ -9757,5 +9872,5 @@ getJasmineRequireObj().UserContext = function(j$) {
9757
9872
  };
9758
9873
 
9759
9874
  getJasmineRequireObj().version = function() {
9760
- return '3.8.0';
9875
+ return '3.9.0';
9761
9876
  };
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module Jasmine
6
6
  module Core
7
- VERSION = "3.8.0"
7
+ VERSION = "3.9.0"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Van Hove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-02 00:00:00.000000000 Z
11
+ date: 2021-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -36,7 +36,11 @@ files:
36
36
  - "./lib/jasmine-core/__init__.py"
37
37
  - "./lib/jasmine-core/boot.js"
38
38
  - "./lib/jasmine-core/boot/boot.js"
39
+ - "./lib/jasmine-core/boot/boot0.js"
40
+ - "./lib/jasmine-core/boot/boot1.js"
39
41
  - "./lib/jasmine-core/boot/node_boot.js"
42
+ - "./lib/jasmine-core/boot0.js"
43
+ - "./lib/jasmine-core/boot1.js"
40
44
  - "./lib/jasmine-core/core.py"
41
45
  - "./lib/jasmine-core/example/node_example/lib/jasmine_examples/Player.js"
42
46
  - "./lib/jasmine-core/example/node_example/lib/jasmine_examples/Song.js"
@@ -71,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
75
  - !ruby/object:Gem::Version
72
76
  version: '0'
73
77
  requirements: []
74
- rubygems_version: 3.0.3
78
+ rubygems_version: 3.1.2
75
79
  signing_key:
76
80
  specification_version: 4
77
81
  summary: JavaScript BDD framework