jasmine-core 3.7.1 → 3.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jasmine-core/boot/boot.js +8 -2
- data/lib/jasmine-core/boot/boot0.js +42 -0
- data/lib/jasmine-core/boot/boot1.js +111 -0
- data/lib/jasmine-core/boot.js +9 -3
- data/lib/jasmine-core/boot0.js +64 -0
- data/lib/jasmine-core/boot1.js +133 -0
- data/lib/jasmine-core/core.py +37 -3
- data/lib/jasmine-core/jasmine-html.js +92 -24
- data/lib/jasmine-core/jasmine.css +289 -127
- data/lib/jasmine-core/jasmine.js +1609 -329
- data/lib/jasmine-core/node_boot.js +1 -1
- data/lib/jasmine-core/version.rb +1 -1
- data/lib/jasmine-core.js +3 -2
- data/lib/jasmine-core.rb +27 -2
- metadata +17 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c82f2cad2b9bb4ca4dd95a567ee1cf2bed5d1938247ff3dfe3c34e182c40804
|
|
4
|
+
data.tar.gz: e6e0f670ca4886b8fdd9aa1d88757efdfd7cba381ea1e9c99c82f5affe7f4b3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2bac4df4afbb83a1c2a440e2eef8083e91843e92a4a4df9ee38ecd0063678b77d3428a696734deea582697e4e5111fff750d2f5bfa8edb3921037cdf5d8ffa3
|
|
7
|
+
data.tar.gz: 9fc060a26b269eb1acfbd2a79c507267f649ef839674b2ccd5f87af336fe4efb3e6394f8989fd17d647f04e7987f8b1628befd6191e9119d9621b3fa324e059d
|
|
@@ -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.
|
|
@@ -55,8 +59,8 @@
|
|
|
55
59
|
var filterSpecs = !!queryString.getParam("spec");
|
|
56
60
|
|
|
57
61
|
var config = {
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
stopOnSpecFailure: queryString.getParam("failFast"),
|
|
63
|
+
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"),
|
|
60
64
|
hideDisabled: queryString.getParam("hideDisabled")
|
|
61
65
|
};
|
|
62
66
|
|
|
@@ -136,4 +140,6 @@
|
|
|
136
140
|
return destination;
|
|
137
141
|
}
|
|
138
142
|
|
|
143
|
+
env.deprecated('boot.js is deprecated. Please use boot0.js and boot1.js instead.',
|
|
144
|
+
{ ignoreRunnable: true });
|
|
139
145
|
}());
|
|
@@ -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
|
+
stopOnSpecFailure: queryString.getParam("failFast"),
|
|
31
|
+
stopSpecOnExpectationFailure: 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
|
+
}());
|
data/lib/jasmine-core/boot.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright (c) 2008-
|
|
2
|
+
Copyright (c) 2008-2022 Pivotal Labs
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
5
5
|
a copy of this software and associated documentation files (the
|
|
@@ -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.
|
|
@@ -77,8 +81,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
77
81
|
var filterSpecs = !!queryString.getParam("spec");
|
|
78
82
|
|
|
79
83
|
var config = {
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
stopOnSpecFailure: queryString.getParam("failFast"),
|
|
85
|
+
stopSpecOnExpectationFailure: queryString.getParam("oneFailurePerSpec"),
|
|
82
86
|
hideDisabled: queryString.getParam("hideDisabled")
|
|
83
87
|
};
|
|
84
88
|
|
|
@@ -158,4 +162,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
158
162
|
return destination;
|
|
159
163
|
}
|
|
160
164
|
|
|
165
|
+
env.deprecated('boot.js is deprecated. Please use boot0.js and boot1.js instead.',
|
|
166
|
+
{ ignoreRunnable: true });
|
|
161
167
|
}());
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2008-2022 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-2022 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
|
+
stopOnSpecFailure: queryString.getParam("failFast"),
|
|
53
|
+
stopSpecOnExpectationFailure: 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
|
+
}());
|
data/lib/jasmine-core/core.py
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
import pkg_resources
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
if 'SUPPRESS_JASMINE_DEPRECATION' not in os.environ:
|
|
5
|
+
print('DEPRECATION WARNING:\n' +
|
|
6
|
+
'\n' +
|
|
7
|
+
'The Jasmine packages for Python are deprecated. There will be no further\n' +
|
|
8
|
+
'releases after the end of the Jasmine 3.x series. We recommend migrating to the\n' +
|
|
9
|
+
'following options:\n' +
|
|
10
|
+
'\n' +
|
|
11
|
+
'* jasmine-browser-runner (<https://github.com/jasmine/jasmine-browser>,\n' +
|
|
12
|
+
' `npm install jasmine-browser-runner`) to run specs in browsers, including\n' +
|
|
13
|
+
' headless Chrome and Saucelabs. This is the most direct replacement for the\n' +
|
|
14
|
+
' jasmine server` and `jasmine ci` commands provided by the `jasmine` Python\n' +
|
|
15
|
+
' package.\n' +
|
|
16
|
+
'* The jasmine npm package (<https://github.com/jasmine/jasmine-npm>,\n' +
|
|
17
|
+
' `npm install jasmine`) to run specs under Node.js.\n' +
|
|
18
|
+
'* The standalone distribution from the latest Jasmine release\n' +
|
|
19
|
+
' <https://github.com/jasmine/jasmine/releases> to run specs in browsers with\n' +
|
|
20
|
+
' no additional tools.\n' +
|
|
21
|
+
'* The jasmine-core npm package (`npm install jasmine-core`) if all you need is\n' +
|
|
22
|
+
' the Jasmine assets. This is the direct equivalent of the jasmine-core Python\n' +
|
|
23
|
+
' package.\n' +
|
|
24
|
+
'\n' +
|
|
25
|
+
'Except for the standalone distribution, all of the above are distributed through\n' +
|
|
26
|
+
'npm.\n' +
|
|
27
|
+
'\n' +
|
|
28
|
+
'To prevent this message from appearing, set the SUPPRESS_JASMINE_DEPRECATION\n' +
|
|
29
|
+
'environment variable.\n')
|
|
30
|
+
|
|
2
31
|
|
|
3
32
|
try:
|
|
4
33
|
from collections import OrderedDict
|
|
@@ -25,9 +54,14 @@ class Core(object):
|
|
|
25
54
|
# jasmine.js needs to be first
|
|
26
55
|
js_files.insert(0, 'jasmine.js')
|
|
27
56
|
|
|
28
|
-
#
|
|
57
|
+
# Remove the legacy boot file
|
|
29
58
|
js_files.remove('boot.js')
|
|
30
|
-
|
|
59
|
+
|
|
60
|
+
# boot files need to be last
|
|
61
|
+
js_files.remove('boot0.js')
|
|
62
|
+
js_files.remove('boot1.js')
|
|
63
|
+
js_files.append('boot0.js')
|
|
64
|
+
js_files.append('boot1.js')
|
|
31
65
|
|
|
32
66
|
return cls._uniq(js_files)
|
|
33
67
|
|
|
@@ -57,4 +91,4 @@ class Core(object):
|
|
|
57
91
|
|
|
58
92
|
seen[marker] = 1
|
|
59
93
|
result.append(item)
|
|
60
|
-
return result
|
|
94
|
+
return result
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright (c) 2008-
|
|
2
|
+
Copyright (c) 2008-2022 Pivotal Labs
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
5
5
|
a copy of this software and associated documentation files (the
|
|
@@ -208,7 +208,10 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
208
208
|
' of ' +
|
|
209
209
|
totalSpecsDefined +
|
|
210
210
|
' specs - run all';
|
|
211
|
-
|
|
211
|
+
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
|
212
|
+
var skippedLink =
|
|
213
|
+
(window.location.pathname || '') +
|
|
214
|
+
addToExistingQueryString('spec', '');
|
|
212
215
|
alert.appendChild(
|
|
213
216
|
createDom(
|
|
214
217
|
'span',
|
|
@@ -308,7 +311,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
308
311
|
addDeprecationWarnings(doneResult);
|
|
309
312
|
|
|
310
313
|
for (i = 0; i < deprecationWarnings.length; i++) {
|
|
311
|
-
var
|
|
314
|
+
var children = [],
|
|
315
|
+
context;
|
|
312
316
|
|
|
313
317
|
switch (deprecationWarnings[i].runnableType) {
|
|
314
318
|
case 'spec':
|
|
@@ -321,13 +325,23 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
321
325
|
context = '';
|
|
322
326
|
}
|
|
323
327
|
|
|
328
|
+
deprecationWarnings[i].message.split('\n').forEach(function(line) {
|
|
329
|
+
children.push(line);
|
|
330
|
+
children.push(createDom('br'));
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
children[0] = 'DEPRECATION: ' + children[0];
|
|
334
|
+
children.push(context);
|
|
335
|
+
|
|
336
|
+
if (deprecationWarnings[i].stack) {
|
|
337
|
+
children.push(createExpander(deprecationWarnings[i].stack));
|
|
338
|
+
}
|
|
339
|
+
|
|
324
340
|
alert.appendChild(
|
|
325
341
|
createDom(
|
|
326
342
|
'span',
|
|
327
343
|
{ className: 'jasmine-bar jasmine-warning' },
|
|
328
|
-
|
|
329
|
-
createDom('br'),
|
|
330
|
-
context
|
|
344
|
+
children
|
|
331
345
|
)
|
|
332
346
|
);
|
|
333
347
|
}
|
|
@@ -555,17 +569,20 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
555
569
|
);
|
|
556
570
|
|
|
557
571
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
|
558
|
-
failFastCheckbox.checked = config.
|
|
572
|
+
failFastCheckbox.checked = config.stopOnSpecFailure;
|
|
559
573
|
failFastCheckbox.onclick = function() {
|
|
560
|
-
navigateWithNewParam('failFast', !config.
|
|
574
|
+
navigateWithNewParam('failFast', !config.stopOnSpecFailure);
|
|
561
575
|
};
|
|
562
576
|
|
|
563
577
|
var throwCheckbox = optionsMenuDom.querySelector(
|
|
564
578
|
'#jasmine-throw-failures'
|
|
565
579
|
);
|
|
566
|
-
throwCheckbox.checked = config.
|
|
580
|
+
throwCheckbox.checked = config.stopSpecOnExpectationFailure;
|
|
567
581
|
throwCheckbox.onclick = function() {
|
|
568
|
-
navigateWithNewParam(
|
|
582
|
+
navigateWithNewParam(
|
|
583
|
+
'oneFailurePerSpec',
|
|
584
|
+
!config.stopSpecOnExpectationFailure
|
|
585
|
+
);
|
|
569
586
|
};
|
|
570
587
|
|
|
571
588
|
var randomCheckbox = optionsMenuDom.querySelector(
|
|
@@ -635,24 +652,55 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
635
652
|
suite = suite.parent;
|
|
636
653
|
}
|
|
637
654
|
|
|
638
|
-
|
|
655
|
+
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
|
656
|
+
return (
|
|
657
|
+
(window.location.pathname || '') +
|
|
658
|
+
addToExistingQueryString('spec', els.join(' '))
|
|
659
|
+
);
|
|
639
660
|
}
|
|
640
661
|
|
|
641
662
|
function addDeprecationWarnings(result, runnableType) {
|
|
642
663
|
if (result && result.deprecationWarnings) {
|
|
643
664
|
for (var i = 0; i < result.deprecationWarnings.length; i++) {
|
|
644
665
|
var warning = result.deprecationWarnings[i].message;
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
666
|
+
deprecationWarnings.push({
|
|
667
|
+
message: warning,
|
|
668
|
+
stack: result.deprecationWarnings[i].stack,
|
|
669
|
+
runnableName: result.fullName,
|
|
670
|
+
runnableType: runnableType
|
|
671
|
+
});
|
|
652
672
|
}
|
|
653
673
|
}
|
|
654
674
|
}
|
|
655
675
|
|
|
676
|
+
function createExpander(stackTrace) {
|
|
677
|
+
var expandLink = createDom('a', { href: '#' }, 'Show stack trace');
|
|
678
|
+
var root = createDom(
|
|
679
|
+
'div',
|
|
680
|
+
{ className: 'jasmine-expander' },
|
|
681
|
+
expandLink,
|
|
682
|
+
createDom(
|
|
683
|
+
'div',
|
|
684
|
+
{ className: 'jasmine-expander-contents jasmine-stack-trace' },
|
|
685
|
+
stackTrace
|
|
686
|
+
)
|
|
687
|
+
);
|
|
688
|
+
|
|
689
|
+
expandLink.addEventListener('click', function(e) {
|
|
690
|
+
e.preventDefault();
|
|
691
|
+
|
|
692
|
+
if (root.classList.contains('jasmine-expanded')) {
|
|
693
|
+
root.classList.remove('jasmine-expanded');
|
|
694
|
+
expandLink.textContent = 'Show stack trace';
|
|
695
|
+
} else {
|
|
696
|
+
root.classList.add('jasmine-expanded');
|
|
697
|
+
expandLink.textContent = 'Hide stack trace';
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
return root;
|
|
702
|
+
}
|
|
703
|
+
|
|
656
704
|
function find(selector) {
|
|
657
705
|
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
|
658
706
|
}
|
|
@@ -666,11 +714,23 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
666
714
|
}
|
|
667
715
|
}
|
|
668
716
|
|
|
669
|
-
function createDom(type, attrs,
|
|
670
|
-
var el = createElement(type)
|
|
717
|
+
function createDom(type, attrs, childrenArrayOrVarArgs) {
|
|
718
|
+
var el = createElement(type),
|
|
719
|
+
children,
|
|
720
|
+
i;
|
|
721
|
+
|
|
722
|
+
if (j$.isArray_(childrenArrayOrVarArgs)) {
|
|
723
|
+
children = childrenArrayOrVarArgs;
|
|
724
|
+
} else {
|
|
725
|
+
children = [];
|
|
726
|
+
|
|
727
|
+
for (i = 2; i < arguments.length; i++) {
|
|
728
|
+
children.push(arguments[i]);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
671
731
|
|
|
672
|
-
for (
|
|
673
|
-
var child =
|
|
732
|
+
for (i = 0; i < children.length; i++) {
|
|
733
|
+
var child = children[i];
|
|
674
734
|
|
|
675
735
|
if (typeof child === 'string') {
|
|
676
736
|
el.appendChild(createTextNode(child));
|
|
@@ -699,11 +759,19 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
699
759
|
}
|
|
700
760
|
|
|
701
761
|
function specHref(result) {
|
|
702
|
-
|
|
762
|
+
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
|
763
|
+
return (
|
|
764
|
+
(window.location.pathname || '') +
|
|
765
|
+
addToExistingQueryString('spec', result.fullName)
|
|
766
|
+
);
|
|
703
767
|
}
|
|
704
768
|
|
|
705
769
|
function seedHref(seed) {
|
|
706
|
-
|
|
770
|
+
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
|
771
|
+
return (
|
|
772
|
+
(window.location.pathname || '') +
|
|
773
|
+
addToExistingQueryString('seed', seed)
|
|
774
|
+
);
|
|
707
775
|
}
|
|
708
776
|
|
|
709
777
|
function defaultQueryString(key, value) {
|