less 3.10.3 → 3.11.3

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.
Files changed (143) hide show
  1. package/.github/FUNDING.yml +12 -0
  2. package/CHANGELOG.md +509 -711
  3. package/CONTRIBUTING.md +2 -2
  4. package/Gruntfile.js +42 -212
  5. package/README.md +31 -3
  6. package/bin/lessc +10538 -13511
  7. package/dist/less.cjs.js +10078 -12936
  8. package/dist/less.js +10670 -13462
  9. package/dist/less.min.js +3 -3
  10. package/dist/less.min.js.map +1 -1
  11. package/lib/less/contexts.js +1 -1
  12. package/lib/less/environment/abstract-file-manager.js +1 -1
  13. package/lib/less/import-manager.js +7 -20
  14. package/lib/less/index.js +1 -1
  15. package/lib/less/less-error.js +22 -2
  16. package/lib/less/parse-tree.js +2 -6
  17. package/lib/less/parser/parser.js +10 -10
  18. package/lib/less/tree/debug-info.js +2 -1
  19. package/lib/less/tree/namespace-value.js +1 -2
  20. package/lib/less/visitors/visitor.js +10 -2
  21. package/lib/less-node/file-manager.js +19 -49
  22. package/lib/lessc.js +3 -22
  23. package/package.json +21 -16
  24. package/test/browser/common.js +11 -49
  25. package/test/browser/generator/benchmark.config.js +50 -0
  26. package/test/browser/generator/generate.js +78 -0
  27. package/test/browser/generator/runner.config.js +180 -0
  28. package/test/browser/generator/runner.js +2 -0
  29. package/test/browser/generator/template.js +83 -0
  30. package/test/browser/runner-browser-options.js +0 -6
  31. package/test/browser/runner-browser-spec.js +1 -1
  32. package/test/browser/runner-main-spec.js +1 -1
  33. package/test/browser/runner-modify-vars-spec.js +1 -1
  34. package/test/browser/runner-production-spec.js +1 -1
  35. package/test/css/calc.css +9 -0
  36. package/test/css/comments.css +1 -1
  37. package/test/css/css-3.css +5 -5
  38. package/test/css/css-guards.css +1 -1
  39. package/test/css/debug/linenumbers-all.css +5 -5
  40. package/test/css/debug/linenumbers-comments.css +5 -5
  41. package/test/css/debug/linenumbers-mediaquery.css +5 -5
  42. package/test/css/extend-chaining.css +3 -3
  43. package/test/css/extend-media.css +1 -1
  44. package/test/css/extend-nest.css +1 -1
  45. package/test/css/filemanagerPlugin/filemanager.css +1 -1
  46. package/test/css/functions-each.css +1 -1
  47. package/test/css/import-once.css +2 -2
  48. package/test/css/import-reference-issues.css +1 -1
  49. package/test/css/import-reference.css +6 -6
  50. package/test/css/import.css +1 -1
  51. package/test/css/javascript.css +1 -1
  52. package/test/css/legacy/legacy.css +1 -1
  53. package/test/css/math/parens-division/mixins-args.css +1 -1
  54. package/test/css/math/parens-division/parens.css +1 -1
  55. package/test/css/math/strict/mixins-args.css +1 -1
  56. package/test/css/math/strict/parens.css +1 -1
  57. package/test/css/math/strict-legacy/mixins-args.css +1 -1
  58. package/test/css/math/strict-legacy/parens.css +1 -1
  59. package/test/css/media.css +14 -14
  60. package/test/css/merge.css +10 -10
  61. package/test/css/mixins-guards.css +6 -6
  62. package/test/css/mixins.css +2 -2
  63. package/test/css/namespacing/namespacing-3.css +16 -1
  64. package/test/css/namespacing/namespacing-4.css +1 -1
  65. package/test/css/namespacing/namespacing-functions.css +6 -0
  66. package/test/css/no-strict-math/mixins-guards.css +1 -1
  67. package/test/css/permissive-parse.css +1 -1
  68. package/test/css/plugin.css +9 -9
  69. package/test/css/postProcessorPlugin/postProcessor.css +2 -2
  70. package/test/css/preProcessorPlugin/preProcessor.css +1 -1
  71. package/test/css/selectors.css +2 -2
  72. package/test/css/variables.css +1 -1
  73. package/test/css/visitorPlugin/visitor.css +1 -1
  74. package/test/index.js +6 -0
  75. package/test/less/calc.less +17 -1
  76. package/test/less/comments.less +1 -1
  77. package/test/less/css-3.less +5 -5
  78. package/test/less/css-guards.less +2 -2
  79. package/test/less/debug/import/test.less +2 -2
  80. package/test/less/debug/linenumbers.less +3 -3
  81. package/test/less/errors/color-func-invalid-color.less +1 -1
  82. package/test/less/errors/color-func-invalid-color.txt +1 -1
  83. package/test/less/errors/invalid-color-with-comment.less +1 -0
  84. package/test/less/errors/invalid-color-with-comment.txt +2 -0
  85. package/test/less/errors/plugin-1.txt +2 -2
  86. package/test/less/errors/plugin-2.txt +1 -2
  87. package/test/less/errors/plugin-3.txt +1 -2
  88. package/test/less/errors/property-ie5-hack.less +1 -1
  89. package/test/less/extend-chaining.less +3 -3
  90. package/test/less/extend-media.less +1 -1
  91. package/test/less/extend-nest.less +1 -1
  92. package/test/less/filemanagerPlugin/filemanager.less +1 -1
  93. package/test/less/functions-each.less +1 -1
  94. package/test/less/import/import-reference.less +1 -1
  95. package/test/less/import/import-test-f.less +1 -1
  96. package/test/less/import/json/index.json +11 -0
  97. package/test/less/import/json/index.less +1 -0
  98. package/test/less/import-reference-issues/global-scope-import.less +2 -2
  99. package/test/less/import-reference-issues/global-scope-nested.less +1 -1
  100. package/test/less/import-reference-issues.less +2 -2
  101. package/test/less/import-reference.less +1 -1
  102. package/test/less/javascript.less +1 -1
  103. package/test/less/legacy/legacy.less +1 -1
  104. package/test/less/math/parens-division/mixins-args.less +4 -4
  105. package/test/less/math/parens-division/parens.less +1 -1
  106. package/test/less/math/strict/mixins-args.less +4 -4
  107. package/test/less/math/strict/parens.less +1 -1
  108. package/test/less/math/strict-legacy/mixins-args.less +4 -4
  109. package/test/less/math/strict-legacy/parens.less +1 -1
  110. package/test/less/media.less +9 -9
  111. package/test/less/merge.less +10 -10
  112. package/test/less/mixins-guards.less +8 -8
  113. package/test/less/mixins-important.less +3 -3
  114. package/test/less/mixins.less +2 -2
  115. package/test/less/namespacing/namespacing-3.less +25 -2
  116. package/test/less/namespacing/namespacing-4.less +1 -1
  117. package/test/less/namespacing/namespacing-5.less +2 -2
  118. package/test/less/namespacing/namespacing-functions.less +26 -0
  119. package/test/less/no-strict-math/mixins-guards.less +2 -2
  120. package/test/less/permissive-parse.less +1 -1
  121. package/test/less/plugin.less +9 -9
  122. package/test/less/postProcessorPlugin/postProcessor.less +2 -2
  123. package/test/less/preProcessorPlugin/preProcessor.less +1 -1
  124. package/test/less/selectors.less +1 -1
  125. package/test/less/sourcemaps/imported.css +1 -1
  126. package/test/less/variables.less +1 -1
  127. package/test/less/visitorPlugin/visitor.less +1 -1
  128. package/test/less-test.js +45 -11
  129. package/test/less.js +11 -0
  130. package/test/sourcemaps/custom-props.json +1 -1
  131. package/.DS_Store +0 -0
  132. package/test/.DS_Store +0 -0
  133. package/test/browser/less.min.js +0 -11
  134. package/test/browser/less.min.js.map +0 -1
  135. package/test/browser/onload.js +0 -13
  136. package/test/browser/test-runner-template.tmpl +0 -105
  137. package/test/browser/vendor/boot.js +0 -148
  138. package/test/browser/vendor/jasmine-jsreporter.js +0 -391
  139. package/test/browser/vendor/promise.js +0 -2
  140. package/test/css/.DS_Store +0 -0
  141. package/test/css/math/.DS_Store +0 -0
  142. package/test/less/.DS_Store +0 -0
  143. package/test/less/math/.DS_Store +0 -0
@@ -1,13 +0,0 @@
1
- (function() {
2
- window.DEFER = [window.onload];
3
- Object.defineProperty(window, 'onload', {
4
- get: function() {
5
- return function() {};
6
- },
7
- set: function(fn) {
8
- window.DEFER.push(fn);
9
- },
10
- enumerable: true,
11
- configurable: true
12
- });
13
- })();
@@ -1,105 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
-
6
- <title>Jasmine Spec Runner</title>
7
-
8
- <!-- for each test, generate CSS/LESS link tags -->
9
- <% scripts.src.forEach(function(fullLessName) {
10
- var pathParts = fullLessName.split('/');
11
- var fullCssName = fullLessName.replace(/less/g, 'css');
12
- var lessName = pathParts[pathParts.length - 1];
13
- var name = lessName.split('.')[0]; %>
14
- <!-- the tags to be generated -->
15
- <link id="original-less:test-less-<%= name %>" title="test-less-<%= name %>" rel="stylesheet/less" type="text/css" href="<%= fullLessName %>">
16
- <link id="expected-less:test-less-<%= name %>" rel="stylesheet" type="text/css" href="<%= fullCssName %>">
17
- <% }); %>
18
-
19
- <!-- generate grunt-contrib-jasmine link tags -->
20
- <% css.forEach(function(style){ %>
21
- <link rel="stylesheet" type="text/css" href="<%= style %>">
22
- <% }) %>
23
-
24
- <!-- generate script tags for tests -->
25
- <%
26
-
27
- var generateScriptTags = function(allScripts) {
28
- allScripts.forEach(function(script){
29
- if (script.indexOf('boot.js') > -1) {
30
- script = '../../test/browser/vendor/boot.js'
31
- }
32
- %><script src="<%= script %>"></script> <%
33
- });
34
- };
35
-
36
- generateScriptTags(scripts.polyfills);
37
- generateScriptTags(scripts.jasmine);
38
- generateScriptTags(scripts.boot);
39
- generateScriptTags(scripts.helpers);
40
- generateScriptTags(scripts.vendor);
41
-
42
- %>
43
-
44
- <!-- generate script tags for tests -->
45
- <% var toArray = function(scripts) {
46
- %>[<%
47
- scripts.forEach(function(scriptUrl, index){
48
- %>"<%= scriptUrl %>"<%
49
- if (index !== scripts.length -1) {
50
- %>,<%
51
- }
52
- });
53
- %>]<%
54
- }; %>
55
-
56
- <script>
57
-
58
- function loadScript(url,callback){
59
- var script = document.createElement('script');
60
-
61
- if(document.documentMode === 8){
62
- script.onreadystatechange = function(){
63
- if (script.readyState === 'loaded'){
64
- if (callback){callback()};
65
- };
66
- };
67
- } else {
68
- script.onload = function(){
69
- if (callback){callback()};
70
- };
71
- };
72
- script.src = url;
73
- document.body.appendChild(script);
74
- };
75
-
76
- var specs = <% toArray(scripts.specs) %>,
77
- reporters = <% toArray([].concat(scripts.reporters)) %>,
78
- runScripts = specs.concat(reporters);
79
- </script>
80
-
81
- <script>
82
- window.addEventListener('load', function() {
83
-
84
- function addNextScript() {
85
- // for sauce, see above. Additional step needed between loading jasmine and loading
86
- // the js reporter
87
- if (runScripts.length) {
88
- var scriptSrc = runScripts.shift();
89
- loadScript(scriptSrc, addNextScript);
90
- }
91
- else {
92
- // deferred boot function
93
- window.DEFER();
94
- }
95
- }
96
- addNextScript();
97
-
98
- });
99
- </script>
100
- </head>
101
-
102
- <body>
103
- <!-- content -->
104
- </body>
105
- </html>
@@ -1,148 +0,0 @@
1
- // Modified from grunt-contrib-jasmine
2
-
3
- /*
4
- Copyright (c) 2008-2015 Pivotal Labs
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining
7
- a copy of this software and associated documentation files (the
8
- "Software"), to deal in the Software without restriction, including
9
- without limitation the rights to use, copy, modify, merge, publish,
10
- distribute, sublicense, and/or sell copies of the Software, and to
11
- permit persons to whom the Software is furnished to do so, subject to
12
- the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be
15
- included in all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- */
25
- /**
26
- 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.
27
-
28
- 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.
29
-
30
- The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
31
-
32
- [jasmine-gem]: http://github.com/pivotal/jasmine-gem
33
- */
34
-
35
- (function() {
36
-
37
- /**
38
- * ## Require &amp; Instantiate
39
- *
40
- * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
41
- */
42
- window.jasmine = jasmineRequire.core(jasmineRequire);
43
-
44
- /**
45
- * 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.
46
- */
47
- jasmineRequire.html(jasmine);
48
-
49
- /**
50
- * Create the Jasmine environment. This is used to run all specs in a project.
51
- */
52
- var env = jasmine.getEnv();
53
-
54
- /**
55
- * ## The Global Interface
56
- *
57
- * 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.
58
- */
59
- var jasmineInterface = jasmineRequire.interface(jasmine, env);
60
-
61
- /**
62
- * 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`.
63
- */
64
- extend(window, jasmineInterface);
65
-
66
- /**
67
- * ## Runner Parameters
68
- *
69
- * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
70
- */
71
-
72
- var queryString = new jasmine.QueryString({
73
- getWindowLocation: function() { return window.location; }
74
- });
75
-
76
- var catchingExceptions = queryString.getParam("catch");
77
- env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
78
-
79
- var throwingExpectationFailures = queryString.getParam("throwFailures");
80
- env.throwOnExpectationFailure(throwingExpectationFailures);
81
-
82
- var random = queryString.getParam("random");
83
- env.randomizeTests(random);
84
-
85
- var seed = queryString.getParam("seed");
86
- if (seed) {
87
- env.seed(seed);
88
- }
89
-
90
- /**
91
- * ## Reporters
92
- * 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).
93
- */
94
- var htmlReporter = new jasmine.HtmlReporter({
95
- env: env,
96
- onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
97
- onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
98
- onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
99
- addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
100
- getContainer: function() { return document.body; },
101
- createElement: function() { return document.createElement.apply(document, arguments); },
102
- createTextNode: function() { return document.createTextNode.apply(document, arguments); },
103
- timer: new jasmine.Timer()
104
- });
105
-
106
- /**
107
- * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
108
- */
109
- env.addReporter(jasmineInterface.jsApiReporter);
110
- env.addReporter(htmlReporter);
111
-
112
- /**
113
- * Filter which specs will be run by matching the start of the full name against the `spec` query param.
114
- */
115
- var specFilter = new jasmine.HtmlSpecFilter({
116
- filterString: function() { return queryString.getParam("spec"); }
117
- });
118
-
119
- env.specFilter = function(spec) {
120
- return specFilter.matches(spec.getFullName());
121
- };
122
-
123
- /**
124
- * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
125
- */
126
- window.setTimeout = window.setTimeout;
127
- window.setInterval = window.setInterval;
128
- window.clearTimeout = window.clearTimeout;
129
- window.clearInterval = window.clearInterval;
130
-
131
- /**
132
- * Customized for Less.js
133
- */
134
-
135
- window.DEFER = function() {
136
- htmlReporter.initialize();
137
- env.execute();
138
- };
139
-
140
- /**
141
- * Helper function for readability above.
142
- */
143
- function extend(destination, source) {
144
- for (var property in source) destination[property] = source[property];
145
- return destination;
146
- }
147
-
148
- }());
@@ -1,391 +0,0 @@
1
- /*
2
- This file is part of the Jasmine JSReporter project from Ivan De Marino.
3
-
4
- Copyright (C) 2011-2014 Ivan De Marino <http://ivandemarino.me>
5
- Copyright (C) 2014 Alex Treppass <http://alextreppass.co.uk>
6
-
7
- Redistribution and use in source and binary forms, with or without
8
- modification, are permitted provided that the following conditions are met:
9
-
10
- * Redistributions of source code must retain the above copyright
11
- notice, this list of conditions and the following disclaimer.
12
- * Redistributions in binary form must reproduce the above copyright
13
- notice, this list of conditions and the following disclaimer in the
14
- documentation and/or other materials provided with the distribution.
15
- * Neither the name of the <organization> nor the
16
- names of its contributors may be used to endorse or promote products
17
- derived from this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- ARE DISCLAIMED. IN NO EVENT SHALL IVAN DE MARINO BE LIABLE FOR ANY
23
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
30
- (function (jasmine) {
31
-
32
- if (!jasmine) {
33
- throw new Error("[Jasmine JSReporter] 'Jasmine' library not found");
34
- }
35
-
36
- // ------------------------------------------------------------------------
37
- // Jasmine JSReporter for Jasmine 1.x
38
- // ------------------------------------------------------------------------
39
-
40
- /**
41
- * Calculate elapsed time, in Seconds.
42
- * @param startMs Start time in Milliseconds
43
- * @param finishMs Finish time in Milliseconds
44
- * @return Elapsed time in Seconds */
45
- function elapsedSec(startMs, finishMs) {
46
- return (finishMs - startMs) / 1000;
47
- }
48
-
49
- /**
50
- * Round an amount to the given number of Digits.
51
- * If no number of digits is given, than '2' is assumed.
52
- * @param amount Amount to round
53
- * @param numOfDecDigits Number of Digits to round to. Default value is '2'.
54
- * @return Rounded amount */
55
- function round(amount, numOfDecDigits) {
56
- numOfDecDigits = numOfDecDigits || 2;
57
- return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits);
58
- }
59
-
60
- /**
61
- * Create a new array which contains only the failed items.
62
- * @param items Items which will be filtered
63
- * @returns {Array} of failed items */
64
- function failures(items) {
65
- var fs = [], i, v;
66
- for (i = 0; i < items.length; i += 1) {
67
- v = items[i];
68
- if (!v.passed_) {
69
- fs.push(v);
70
- }
71
- }
72
- return fs;
73
- }
74
-
75
- /**
76
- * Collect information about a Suite, recursively, and return a JSON result.
77
- * @param suite The Jasmine Suite to get data from
78
- */
79
- function getSuiteData(suite) {
80
- var suiteData = {
81
- description : suite.description,
82
- durationSec : 0,
83
- specs: [],
84
- suites: [],
85
- passed: true
86
- },
87
- specs = suite.specs(),
88
- suites = suite.suites(),
89
- i, ilen;
90
-
91
- // Loop over all the Suite's Specs
92
- for (i = 0, ilen = specs.length; i < ilen; ++i) {
93
- suiteData.specs[i] = {
94
- description : specs[i].description,
95
- durationSec : specs[i].durationSec,
96
- passed : specs[i].results().passedCount === specs[i].results().totalCount,
97
- skipped : specs[i].results().skipped,
98
- passedCount : specs[i].results().passedCount,
99
- failedCount : specs[i].results().failedCount,
100
- totalCount : specs[i].results().totalCount,
101
- failures: failures(specs[i].results().getItems())
102
- };
103
- suiteData.passed = !suiteData.specs[i].passed ? false : suiteData.passed;
104
- suiteData.durationSec += suiteData.specs[i].durationSec;
105
- }
106
-
107
- // Loop over all the Suite's sub-Suites
108
- for (i = 0, ilen = suites.length; i < ilen; ++i) {
109
- suiteData.suites[i] = getSuiteData(suites[i]); //< recursive population
110
- suiteData.passed = !suiteData.suites[i].passed ? false : suiteData.passed;
111
- suiteData.durationSec += suiteData.suites[i].durationSec;
112
- }
113
-
114
- // Rounding duration numbers to 3 decimal digits
115
- suiteData.durationSec = round(suiteData.durationSec, 4);
116
-
117
- return suiteData;
118
- }
119
-
120
- var JSReporter = function () {
121
- };
122
-
123
- JSReporter.prototype = {
124
- reportRunnerStarting: function (runner) {
125
- // Nothing to do
126
- },
127
-
128
- reportSpecStarting: function (spec) {
129
- // Start timing this spec
130
- spec.startedAt = new Date();
131
- },
132
-
133
- reportSpecResults: function (spec) {
134
- // Finish timing this spec and calculate duration/delta (in sec)
135
- spec.finishedAt = new Date();
136
- // If the spec was skipped, reportSpecStarting is never called and spec.startedAt is undefined
137
- spec.durationSec = spec.startedAt ? elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()) : 0;
138
- },
139
-
140
- reportSuiteResults: function (suite) {
141
- // Nothing to do
142
- },
143
-
144
- reportRunnerResults: function (runner) {
145
- var suites = runner.suites(),
146
- i, j, ilen;
147
-
148
- // Attach results to the "jasmine" object to make those results easy to scrap/find
149
- jasmine.runnerResults = {
150
- suites: [],
151
- durationSec : 0,
152
- passed : true
153
- };
154
-
155
- // Loop over all the Suites
156
- for (i = 0, ilen = suites.length, j = 0; i < ilen; ++i) {
157
- if (suites[i].parentSuite === null) {
158
- jasmine.runnerResults.suites[j] = getSuiteData(suites[i]);
159
- // If 1 suite fails, the whole runner fails
160
- jasmine.runnerResults.passed = !jasmine.runnerResults.suites[j].passed ? false : jasmine.runnerResults.passed;
161
- // Add up all the durations
162
- jasmine.runnerResults.durationSec += jasmine.runnerResults.suites[j].durationSec;
163
- j++;
164
- }
165
- }
166
-
167
- // Decorate the 'jasmine' object with getters
168
- jasmine.getJSReport = function () {
169
- if (jasmine.runnerResults) {
170
- return jasmine.runnerResults;
171
- }
172
- return null;
173
- };
174
- jasmine.getJSReportAsString = function () {
175
- return JSON.stringify(jasmine.getJSReport());
176
- };
177
- }
178
- };
179
-
180
- // export public
181
- jasmine.JSReporter = JSReporter;
182
-
183
- // ------------------------------------------------------------------------
184
- // Jasmine JSReporter for Jasmine 2.0
185
- // ------------------------------------------------------------------------
186
-
187
- /*
188
- Simple timer implementation
189
- */
190
- var Timer = function () {};
191
-
192
- Timer.prototype.start = function () {
193
- this.startTime = new Date().getTime();
194
- return this;
195
- };
196
-
197
- Timer.prototype.elapsed = function () {
198
- if (this.startTime == null) {
199
- return -1;
200
- }
201
- return new Date().getTime() - this.startTime;
202
- };
203
-
204
- /*
205
- Utility methods
206
- */
207
- var _extend = function (obj1, obj2) {
208
- for (var prop in obj2) {
209
- obj1[prop] = obj2[prop];
210
- }
211
- return obj1;
212
- };
213
- var _clone = function (obj) {
214
- if (obj !== Object(obj)) {
215
- return obj;
216
- }
217
- return _extend({}, obj);
218
- };
219
-
220
- jasmine.JSReporter2 = function () {
221
- this.specs = {};
222
- this.suites = {};
223
- this.rootSuites = [];
224
- this.suiteStack = [];
225
-
226
- // export methods under jasmine namespace
227
- jasmine.getJSReport = this.getJSReport;
228
- jasmine.getJSReportAsString = this.getJSReportAsString;
229
- };
230
-
231
- var JSR = jasmine.JSReporter2.prototype;
232
-
233
- // Reporter API methods
234
- // --------------------
235
-
236
- JSR.suiteStarted = function (suite) {
237
- suite = this._cacheSuite(suite);
238
- // build up suite tree as we go
239
- suite.specs = [];
240
- suite.suites = [];
241
- suite.passed = true;
242
- suite.parentId = this.suiteStack.slice(this.suiteStack.length - 1)[0];
243
- if (suite.parentId) {
244
- this.suites[suite.parentId].suites.push(suite);
245
- } else {
246
- this.rootSuites.push(suite.id);
247
- }
248
- this.suiteStack.push(suite.id);
249
- suite.timer = new Timer().start();
250
- };
251
-
252
- JSR.suiteDone = function (suite) {
253
- suite = this._cacheSuite(suite);
254
- suite.duration = suite.timer.elapsed();
255
- suite.durationSec = suite.duration / 1000;
256
- this.suiteStack.pop();
257
-
258
- // maintain parent suite state
259
- var parent = this.suites[suite.parentId];
260
- if (parent) {
261
- parent.passed = parent.passed && suite.passed;
262
- }
263
-
264
- // keep report representation clean
265
- delete suite.timer;
266
- delete suite.id;
267
- delete suite.parentId;
268
- delete suite.fullName;
269
- };
270
-
271
- JSR.specStarted = function (spec) {
272
- spec = this._cacheSpec(spec);
273
- spec.timer = new Timer().start();
274
- // build up suites->spec tree as we go
275
- spec.suiteId = this.suiteStack.slice(this.suiteStack.length - 1)[0];
276
- this.suites[spec.suiteId].specs.push(spec);
277
- };
278
-
279
- JSR.specDone = function (spec) {
280
- spec = this._cacheSpec(spec);
281
-
282
- spec.duration = spec.timer.elapsed();
283
- spec.durationSec = spec.duration / 1000;
284
-
285
- spec.skipped = spec.status === 'pending';
286
- spec.passed = spec.skipped || spec.status === 'passed';
287
-
288
- spec.totalCount = spec.passedExpectations.length + spec.failedExpectations.length;
289
- spec.passedCount = spec.passedExpectations.length;
290
- spec.failedCount = spec.failedExpectations.length;
291
- spec.failures = [];
292
-
293
- for (var i = 0, j = spec.failedExpectations.length; i < j; i++) {
294
- var fail = spec.failedExpectations[i];
295
- spec.failures.push({
296
- type: 'expect',
297
- expected: fail.expected,
298
- passed: false,
299
- message: fail.message,
300
- matcherName: fail.matcherName,
301
- trace: {
302
- stack: fail.stack
303
- }
304
- });
305
- }
306
-
307
- // maintain parent suite state
308
- var parent = this.suites[spec.suiteId];
309
- if (spec.failed) {
310
- parent.failingSpecs.push(spec);
311
- }
312
- parent.passed = parent.passed && spec.passed;
313
-
314
- // keep report representation clean
315
- delete spec.timer;
316
- delete spec.totalExpectations;
317
- delete spec.passedExpectations;
318
- delete spec.suiteId;
319
- delete spec.fullName;
320
- delete spec.id;
321
- delete spec.status;
322
- delete spec.failedExpectations;
323
- };
324
-
325
- JSR.jasmineDone = function () {
326
- this._buildReport();
327
- };
328
-
329
- JSR.getJSReport = function () {
330
- if (jasmine.jsReport) {
331
- return jasmine.jsReport;
332
- }
333
- };
334
-
335
- JSR.getJSReportAsString = function () {
336
- if (jasmine.jsReport) {
337
- return JSON.stringify(jasmine.jsReport);
338
- }
339
- };
340
-
341
- // Private methods
342
- // ---------------
343
-
344
- JSR._haveSpec = function (spec) {
345
- return this.specs[spec.id] != null;
346
- };
347
-
348
- JSR._cacheSpec = function (spec) {
349
- var existing = this.specs[spec.id];
350
- if (existing == null) {
351
- existing = this.specs[spec.id] = _clone(spec);
352
- } else {
353
- _extend(existing, spec);
354
- }
355
- return existing;
356
- };
357
-
358
- JSR._haveSuite = function (suite) {
359
- return this.suites[suite.id] != null;
360
- };
361
-
362
- JSR._cacheSuite = function (suite) {
363
- var existing = this.suites[suite.id];
364
- if (existing == null) {
365
- existing = this.suites[suite.id] = _clone(suite);
366
- } else {
367
- _extend(existing, suite);
368
- }
369
- return existing;
370
- };
371
-
372
- JSR._buildReport = function () {
373
- var overallDuration = 0;
374
- var overallPassed = true;
375
- var overallSuites = [];
376
-
377
- for (var i = 0, j = this.rootSuites.length; i < j; i++) {
378
- var suite = this.suites[this.rootSuites[i]];
379
- overallDuration += suite.duration;
380
- overallPassed = overallPassed && suite.passed;
381
- overallSuites.push(suite);
382
- }
383
-
384
- jasmine.jsReport = {
385
- passed: overallPassed,
386
- durationSec: overallDuration / 1000,
387
- suites: overallSuites
388
- };
389
- };
390
-
391
- })(jasmine);
@@ -1,2 +0,0 @@
1
- !function n(t,e,r){function o(u,f){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var l=e[u]={exports:{}};t[u][0].call(l.exports,function(n){var e=t[u][1][n];return o(e?e:n)},l,l.exports,n,t,e,r)}return e[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,t,e){"use strict";function r(){}function o(n){try{return n.then}catch(t){return d=t,w}}function i(n,t){try{return n(t)}catch(e){return d=e,w}}function u(n,t,e){try{n(t,e)}catch(r){return d=r,w}}function f(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._37=0,this._12=null,this._59=[],n!==r&&v(n,this)}function c(n,t,e){return new n.constructor(function(o,i){var u=new f(r);u.then(o,i),s(n,new p(t,e,u))})}function s(n,t){for(;3===n._37;)n=n._12;return 0===n._37?void n._59.push(t):void y(function(){var e=1===n._37?t.onFulfilled:t.onRejected;if(null===e)return void(1===n._37?l(t.promise,n._12):a(t.promise,n._12));var r=i(e,n._12);r===w?a(t.promise,d):l(t.promise,r)})}function l(n,t){if(t===n)return a(n,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var e=o(t);if(e===w)return a(n,d);if(e===n.then&&t instanceof f)return n._37=3,n._12=t,void h(n);if("function"==typeof e)return void v(e.bind(t),n)}n._37=1,n._12=t,h(n)}function a(n,t){n._37=2,n._12=t,h(n)}function h(n){for(var t=0;t<n._59.length;t++)s(n,n._59[t]);n._59=null}function p(n,t,e){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.promise=e}function v(n,t){var e=!1,r=u(n,function(n){e||(e=!0,l(t,n))},function(n){e||(e=!0,a(t,n))});e||r!==w||(e=!0,a(t,d))}var y=n("asap/raw"),d=null,w={};t.exports=f,f._99=r,f.prototype.then=function(n,t){if(this.constructor!==f)return c(this,n,t);var e=new f(r);return s(this,new p(n,t,e)),e}},{"asap/raw":4}],2:[function(n,t,e){"use strict";function r(n){var t=new o(o._99);return t._37=1,t._12=n,t}var o=n("./core.js");t.exports=o;var i=r(!0),u=r(!1),f=r(null),c=r(void 0),s=r(0),l=r("");o.resolve=function(n){if(n instanceof o)return n;if(null===n)return f;if(void 0===n)return c;if(n===!0)return i;if(n===!1)return u;if(0===n)return s;if(""===n)return l;if("object"==typeof n||"function"==typeof n)try{var t=n.then;if("function"==typeof t)return new o(t.bind(n))}catch(e){return new o(function(n,t){t(e)})}return r(n)},o.all=function(n){var t=Array.prototype.slice.call(n);return new o(function(n,e){function r(u,f){if(f&&("object"==typeof f||"function"==typeof f)){if(f instanceof o&&f.then===o.prototype.then){for(;3===f._37;)f=f._12;return 1===f._37?r(u,f._12):(2===f._37&&e(f._12),void f.then(function(n){r(u,n)},e))}var c=f.then;if("function"==typeof c){var s=new o(c.bind(f));return void s.then(function(n){r(u,n)},e)}}t[u]=f,0===--i&&n(t)}if(0===t.length)return n([]);for(var i=t.length,u=0;u<t.length;u++)r(u,t[u])})},o.reject=function(n){return new o(function(t,e){e(n)})},o.race=function(n){return new o(function(t,e){n.forEach(function(n){o.resolve(n).then(t,e)})})},o.prototype["catch"]=function(n){return this.then(null,n)}},{"./core.js":1}],3:[function(n,t,e){"use strict";function r(){if(c.length)throw c.shift()}function o(n){var t;t=f.length?f.pop():new i,t.task=n,u(t)}function i(){this.task=null}var u=n("./raw"),f=[],c=[],s=u.makeRequestCallFromTimer(r);t.exports=o,i.prototype.call=function(){try{this.task.call()}catch(n){o.onerror?o.onerror(n):(c.push(n),s())}finally{this.task=null,f[f.length]=this}}},{"./raw":4}],4:[function(n,t,e){(function(n){"use strict";function e(n){f.length||(u(),c=!0),f[f.length]=n}function r(){for(;s<f.length;){var n=s;if(s+=1,f[n].call(),s>l){for(var t=0,e=f.length-s;e>t;t++)f[t]=f[t+s];f.length-=s,s=0}}f.length=0,s=0,c=!1}function o(n){var t=1,e=new a(n),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}function i(n){return function(){function t(){clearTimeout(e),clearInterval(r),n()}var e=setTimeout(t,0),r=setInterval(t,50)}}t.exports=e;var u,f=[],c=!1,s=0,l=1024,a=n.MutationObserver||n.WebKitMutationObserver;u="function"==typeof a?o(r):i(r),e.requestFlush=u,e.makeRequestCallFromTimer=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(n,t,e){"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(n,t){var e=arguments.length?this.then.apply(this,arguments):this;e.then(null,function(n){setTimeout(function(){throw n},0)})})},{}],6:[function(n,t,e){n("asap");"undefined"==typeof Promise&&(Promise=n("./lib/core.js"),n("./lib/es6-extensions.js")),n("./polyfill-done.js")},{"./lib/core.js":1,"./lib/es6-extensions.js":2,"./polyfill-done.js":5,asap:3}]},{},[6]);
2
- //# sourceMappingURL=/polyfills/promise-7.0.4.min.js.map
Binary file
Binary file
Binary file
Binary file