jasmine-core 3.7.0 → 3.10.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: b179177ba1e2812c9f21512a2033915f3340ecaa449b238792afea2b5864a6f0
4
- data.tar.gz: fe1dd9a648c9e9f54a07adb8d6106f54172a27072e7d669c17efee0f7c70127a
3
+ metadata.gz: 84c11baffb01d3c56c6968d09ddac1b424a13ad98e213c0650659dd7b95caa18
4
+ data.tar.gz: dd4310821ea95c3a49aca3f39be0661b3f5b2cc30978ba6a055fa2f5f9470848
5
5
  SHA512:
6
- metadata.gz: 5f6e820886e35aa0d6785b91183b47fd32f0ad6606c90d4998a1a964767559c1d8d08a0567897f1df82ebeb1b1f3f7d10fca7e7a5e6dd99df084efd62be0f7b5
7
- data.tar.gz: c52ce3dbe5aacf5cc7884a754d94915f4eafbc47e9461682164c16f73538009fa65a5b7988c402205b620d6ba20aa0040a73eec0dfafb50bdf105af8bd3b990d
6
+ metadata.gz: f6af4a7da56dbcbb0fc0ce68d9912953a11238d8dee921ea412b737a6f89b538f8b0e4b1e5e23e8595afb37f127163739a9182634d69406ef969386377497ed6
7
+ data.tar.gz: 0b594b10d7f30584a41b7cd220fc07d1e020b50ec00632f0e1d2c3652c83374ca45758113519c54f2131f75246ceafb49576be9ae074abe3c0f31db2d3082590
@@ -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
+ }());
@@ -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.
@@ -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
+ }());
@@ -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
@@ -29,6 +58,11 @@ class Core(object):
29
58
  js_files.remove('boot.js')
30
59
  js_files.append('boot.js')
31
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
+
32
66
  return cls._uniq(js_files)
33
67
 
34
68
  @classmethod
@@ -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
@@ -208,7 +208,10 @@ jasmineRequire.HtmlReporter = function(j$) {
208
208
  ' of ' +
209
209
  totalSpecsDefined +
210
210
  ' specs - run all';
211
- var skippedLink = addToExistingQueryString('spec', '');
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',
@@ -555,17 +558,20 @@ jasmineRequire.HtmlReporter = function(j$) {
555
558
  );
556
559
 
557
560
  var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
558
- failFastCheckbox.checked = config.failFast;
561
+ failFastCheckbox.checked = config.stopOnSpecFailure;
559
562
  failFastCheckbox.onclick = function() {
560
- navigateWithNewParam('failFast', !config.failFast);
563
+ navigateWithNewParam('failFast', !config.stopOnSpecFailure);
561
564
  };
562
565
 
563
566
  var throwCheckbox = optionsMenuDom.querySelector(
564
567
  '#jasmine-throw-failures'
565
568
  );
566
- throwCheckbox.checked = config.oneFailurePerSpec;
569
+ throwCheckbox.checked = config.stopSpecOnExpectationFailure;
567
570
  throwCheckbox.onclick = function() {
568
- navigateWithNewParam('throwFailures', !config.oneFailurePerSpec);
571
+ navigateWithNewParam(
572
+ 'oneFailurePerSpec',
573
+ !config.stopSpecOnExpectationFailure
574
+ );
569
575
  };
570
576
 
571
577
  var randomCheckbox = optionsMenuDom.querySelector(
@@ -635,7 +641,11 @@ jasmineRequire.HtmlReporter = function(j$) {
635
641
  suite = suite.parent;
636
642
  }
637
643
 
638
- return addToExistingQueryString('spec', els.join(' '));
644
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
645
+ return (
646
+ (window.location.pathname || '') +
647
+ addToExistingQueryString('spec', els.join(' '))
648
+ );
639
649
  }
640
650
 
641
651
  function addDeprecationWarnings(result, runnableType) {
@@ -699,11 +709,19 @@ jasmineRequire.HtmlReporter = function(j$) {
699
709
  }
700
710
 
701
711
  function specHref(result) {
702
- return addToExistingQueryString('spec', result.fullName);
712
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
713
+ return (
714
+ (window.location.pathname || '') +
715
+ addToExistingQueryString('spec', result.fullName)
716
+ );
703
717
  }
704
718
 
705
719
  function seedHref(seed) {
706
- return addToExistingQueryString('seed', seed);
720
+ // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
721
+ return (
722
+ (window.location.pathname || '') +
723
+ addToExistingQueryString('seed', seed)
724
+ );
707
725
  }
708
726
 
709
727
  function defaultQueryString(key, value) {