jasmine-core 6.0.0-alpha.1 → 6.0.0-beta.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.
- package/README.md +1 -1
- package/lib/jasmine-core/boot1.js +10 -28
- package/lib/jasmine-core/jasmine-html.js +295 -95
- package/lib/jasmine-core/jasmine.css +29 -4
- package/lib/jasmine-core/jasmine.js +471 -197
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Microsoft Edge) as well as Node.
|
|
|
30
30
|
| Environment | Supported versions |
|
|
31
31
|
|-------------------|----------------------------------|
|
|
32
32
|
| Node | 20, 22, 24 |
|
|
33
|
-
| Safari | 16*, 17*
|
|
33
|
+
| Safari | 16*, 17*, 26* |
|
|
34
34
|
| Chrome | Evergreen |
|
|
35
35
|
| Firefox | Evergreen, 102*, 115*, 128*, 140 |
|
|
36
36
|
| Edge | Evergreen |
|
|
@@ -42,36 +42,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
42
42
|
const urls = new jasmine.HtmlReporterV2Urls();
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* Configures Jasmine based on the current set of query parameters. This
|
|
46
|
+
* supports all parameters set by the HTML reporter as well as
|
|
47
|
+
* spec=partialPath, which filters out specs whose paths don't contain the
|
|
48
|
+
* parameter.
|
|
47
49
|
*/
|
|
48
|
-
const htmlReporter = new jasmine.HtmlReporterV2({
|
|
49
|
-
env,
|
|
50
|
-
urls,
|
|
51
|
-
getContainer() {
|
|
52
|
-
return document.body;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
|
|
58
|
-
*/
|
|
59
|
-
env.addReporter(jsApiReporter);
|
|
60
|
-
env.addReporter(htmlReporter);
|
|
61
50
|
env.configure(urls.configFromCurrentUrl());
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const currentWindowOnload = window.onload;
|
|
69
|
-
|
|
70
|
-
window.onload = function() {
|
|
71
|
-
if (currentWindowOnload) {
|
|
72
|
-
currentWindowOnload();
|
|
73
|
-
}
|
|
74
|
-
htmlReporter.initialize();
|
|
52
|
+
window.addEventListener('load', function() {
|
|
53
|
+
// The HTML reporter needs to be set up here so it can access the DOM. Other
|
|
54
|
+
// reporters can be added at any time before env.execute() is called.
|
|
55
|
+
const htmlReporter = new jasmine.HtmlReporterV2({ env, urls });
|
|
56
|
+
env.addReporter(htmlReporter);
|
|
75
57
|
env.execute();
|
|
76
|
-
};
|
|
58
|
+
});
|
|
77
59
|
})();
|
|
@@ -35,6 +35,8 @@ jasmineRequire.html = function(j$) {
|
|
|
35
35
|
j$.private.SymbolsView = jasmineRequire.SymbolsView(j$);
|
|
36
36
|
j$.private.SummaryTreeView = jasmineRequire.SummaryTreeView(j$);
|
|
37
37
|
j$.private.FailuresView = jasmineRequire.FailuresView(j$);
|
|
38
|
+
j$.private.PerformanceView = jasmineRequire.PerformanceView(j$);
|
|
39
|
+
j$.private.TabBar = jasmineRequire.TabBar(j$);
|
|
38
40
|
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
|
39
41
|
j$.HtmlReporterV2Urls = jasmineRequire.HtmlReporterV2Urls(j$);
|
|
40
42
|
j$.HtmlReporterV2 = jasmineRequire.HtmlReporterV2(j$);
|
|
@@ -187,16 +189,52 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|
|
187
189
|
results.appendChild(summary.rootEl);
|
|
188
190
|
|
|
189
191
|
if (this.#stateBuilder.anyNonTopSuiteFailures) {
|
|
190
|
-
this.#
|
|
191
|
-
() => this.#setMenuModeTo('jasmine-failure-list'),
|
|
192
|
-
() => this.#setMenuModeTo('jasmine-spec-list')
|
|
193
|
-
);
|
|
194
|
-
|
|
192
|
+
this.#addFailureToggle();
|
|
195
193
|
this.#setMenuModeTo('jasmine-failure-list');
|
|
196
194
|
this.#failures.show();
|
|
197
195
|
}
|
|
198
196
|
}
|
|
199
197
|
|
|
198
|
+
#addFailureToggle() {
|
|
199
|
+
const onClickFailures = () => this.#setMenuModeTo('jasmine-failure-list');
|
|
200
|
+
const onClickSpecList = () => this.#setMenuModeTo('jasmine-spec-list');
|
|
201
|
+
const failuresLink = createDom(
|
|
202
|
+
'a',
|
|
203
|
+
{ className: 'jasmine-failures-menu', href: '#' },
|
|
204
|
+
'Failures'
|
|
205
|
+
);
|
|
206
|
+
let specListLink = createDom(
|
|
207
|
+
'a',
|
|
208
|
+
{ className: 'jasmine-spec-list-menu', href: '#' },
|
|
209
|
+
'Spec List'
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
failuresLink.onclick = function() {
|
|
213
|
+
onClickFailures();
|
|
214
|
+
return false;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
specListLink.onclick = function() {
|
|
218
|
+
onClickSpecList();
|
|
219
|
+
return false;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
this.#alerts.addBar(
|
|
223
|
+
createDom(
|
|
224
|
+
'span',
|
|
225
|
+
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
|
226
|
+
[createDom('span', {}, 'Spec List | '), failuresLink]
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
this.#alerts.addBar(
|
|
230
|
+
createDom(
|
|
231
|
+
'span',
|
|
232
|
+
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
|
233
|
+
[specListLink, createDom('span', {}, ' | Failures ')]
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
200
238
|
#find(selector) {
|
|
201
239
|
return this.#getContainer().querySelector(
|
|
202
240
|
'.jasmine_html-reporter ' + selector
|
|
@@ -271,12 +309,14 @@ jasmineRequire.HtmlSpecFilter = function(j$) {
|
|
|
271
309
|
* @deprecated Use {@link HtmlReporterV2Urls} instead.
|
|
272
310
|
*/
|
|
273
311
|
function HtmlSpecFilter(options) {
|
|
274
|
-
j$.getEnv()
|
|
312
|
+
const env = options?.env ?? j$.getEnv();
|
|
313
|
+
env.deprecated(
|
|
275
314
|
'HtmlReporter and HtmlSpecFilter are deprecated. Use HtmlReporterV2 instead.'
|
|
276
315
|
);
|
|
277
316
|
|
|
278
317
|
const filterString =
|
|
279
318
|
options &&
|
|
319
|
+
options.filterString &&
|
|
280
320
|
options.filterString() &&
|
|
281
321
|
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
282
322
|
const filterPattern = new RegExp(filterString);
|
|
@@ -434,38 +474,6 @@ jasmineRequire.AlertsView = function(j$) {
|
|
|
434
474
|
);
|
|
435
475
|
}
|
|
436
476
|
|
|
437
|
-
addFailureToggle(onClickFailures, onClickSpecList) {
|
|
438
|
-
const failuresLink = createDom(
|
|
439
|
-
'a',
|
|
440
|
-
{ className: 'jasmine-failures-menu', href: '#' },
|
|
441
|
-
'Failures'
|
|
442
|
-
);
|
|
443
|
-
let specListLink = createDom(
|
|
444
|
-
'a',
|
|
445
|
-
{ className: 'jasmine-spec-list-menu', href: '#' },
|
|
446
|
-
'Spec List'
|
|
447
|
-
);
|
|
448
|
-
|
|
449
|
-
failuresLink.onclick = function() {
|
|
450
|
-
onClickFailures();
|
|
451
|
-
return false;
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
specListLink.onclick = function() {
|
|
455
|
-
onClickSpecList();
|
|
456
|
-
return false;
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
this.#createAndAdd('jasmine-menu jasmine-bar jasmine-spec-list', [
|
|
460
|
-
createDom('span', {}, 'Spec List | '),
|
|
461
|
-
failuresLink
|
|
462
|
-
]);
|
|
463
|
-
this.#createAndAdd('jasmine-menu jasmine-bar jasmine-failure-list', [
|
|
464
|
-
specListLink,
|
|
465
|
-
createDom('span', {}, ' | Failures ')
|
|
466
|
-
]);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
477
|
addGlobalFailure(failure) {
|
|
470
478
|
this.#createAndAdd(
|
|
471
479
|
errorBarClassName,
|
|
@@ -895,7 +903,7 @@ jasmineRequire.htmlReporterUtils = function(j$) {
|
|
|
895
903
|
const el = document.createElement(type);
|
|
896
904
|
let children;
|
|
897
905
|
|
|
898
|
-
if (
|
|
906
|
+
if (Array.isArray(childrenArrayOrVarArgs)) {
|
|
899
907
|
children = childrenArrayOrVarArgs;
|
|
900
908
|
} else {
|
|
901
909
|
children = [];
|
|
@@ -946,6 +954,10 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
946
954
|
|
|
947
955
|
const { createDom, noExpectations } = j$.private.htmlReporterUtils;
|
|
948
956
|
|
|
957
|
+
const specListTabId = 'jasmine-specListTab';
|
|
958
|
+
const failuresTabId = 'jasmine-failuresTab';
|
|
959
|
+
const perfTabId = 'jasmine-perfTab';
|
|
960
|
+
|
|
949
961
|
/**
|
|
950
962
|
* @class HtmlReporterV2
|
|
951
963
|
* @classdesc Displays results and allows re-running individual specs and suites.
|
|
@@ -958,12 +970,12 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
958
970
|
* const reporter = new jasmine.HtmlReporterV2({
|
|
959
971
|
* env,
|
|
960
972
|
* urls,
|
|
961
|
-
* container
|
|
973
|
+
* // container is optional and defaults to document.body.
|
|
974
|
+
* container: someElement
|
|
962
975
|
* });
|
|
963
976
|
*/
|
|
964
977
|
class HtmlReporterV2 {
|
|
965
|
-
#
|
|
966
|
-
#getContainer;
|
|
978
|
+
#container;
|
|
967
979
|
#queryString;
|
|
968
980
|
#urlBuilder;
|
|
969
981
|
#filterSpecs;
|
|
@@ -974,14 +986,13 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
974
986
|
// Sub-views
|
|
975
987
|
#alerts;
|
|
976
988
|
#statusBar;
|
|
989
|
+
#tabBar;
|
|
977
990
|
#progress;
|
|
978
991
|
#banner;
|
|
979
992
|
#failures;
|
|
980
993
|
|
|
981
994
|
constructor(options) {
|
|
982
|
-
this.#
|
|
983
|
-
|
|
984
|
-
this.#getContainer = options.getContainer;
|
|
995
|
+
this.#container = options.container || document.body;
|
|
985
996
|
this.#queryString =
|
|
986
997
|
options.queryString ||
|
|
987
998
|
new j$.QueryString({
|
|
@@ -994,16 +1005,8 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
994
1005
|
getSuiteById: id => this.#stateBuilder.suitesById[id]
|
|
995
1006
|
});
|
|
996
1007
|
this.#filterSpecs = options.urls.filteringSpecs();
|
|
997
|
-
}
|
|
998
1008
|
|
|
999
|
-
|
|
1000
|
-
* Initializes the reporter. Should be called before {@link Env#execute}.
|
|
1001
|
-
* @function
|
|
1002
|
-
* @name HtmlReporter#initialize
|
|
1003
|
-
*/
|
|
1004
|
-
initialize() {
|
|
1005
|
-
this.#clearPrior();
|
|
1006
|
-
this.#config = this.#env ? this.#env.configuration() : {};
|
|
1009
|
+
this.#config = options.env ? options.env.configuration() : {};
|
|
1007
1010
|
|
|
1008
1011
|
this.#stateBuilder = new j$.private.ResultsStateBuilder();
|
|
1009
1012
|
|
|
@@ -1011,6 +1014,25 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1011
1014
|
this.#statusBar = new j$.private.OverallStatusBar(this.#urlBuilder);
|
|
1012
1015
|
this.#statusBar.showRunning();
|
|
1013
1016
|
this.#alerts.addBar(this.#statusBar.rootEl);
|
|
1017
|
+
|
|
1018
|
+
this.#tabBar = new j$.private.TabBar(
|
|
1019
|
+
[
|
|
1020
|
+
{ id: specListTabId, label: 'Spec List' },
|
|
1021
|
+
{ id: failuresTabId, label: 'Failures' },
|
|
1022
|
+
{ id: perfTabId, label: 'Performance' }
|
|
1023
|
+
],
|
|
1024
|
+
tabId => {
|
|
1025
|
+
if (tabId === specListTabId) {
|
|
1026
|
+
this.#setMenuModeTo('jasmine-spec-list');
|
|
1027
|
+
} else if (tabId === failuresTabId) {
|
|
1028
|
+
this.#setMenuModeTo('jasmine-failure-list');
|
|
1029
|
+
} else {
|
|
1030
|
+
this.#setMenuModeTo('jasmine-performance');
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
this.#alerts.addBar(this.#tabBar.rootEl);
|
|
1035
|
+
|
|
1014
1036
|
this.#progress = new ProgressView();
|
|
1015
1037
|
this.#banner = new j$.private.Banner(
|
|
1016
1038
|
this.#queryString.navigateWithNewParam.bind(this.#queryString),
|
|
@@ -1025,13 +1047,15 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1025
1047
|
this.#alerts.rootEl,
|
|
1026
1048
|
this.#failures.rootEl
|
|
1027
1049
|
);
|
|
1028
|
-
this.#
|
|
1050
|
+
this.#container.appendChild(this.#htmlReporterMain);
|
|
1029
1051
|
this.#failures.show();
|
|
1030
1052
|
}
|
|
1031
1053
|
|
|
1032
1054
|
jasmineStarted(options) {
|
|
1033
1055
|
this.#stateBuilder.jasmineStarted(options);
|
|
1034
|
-
this.#progress.start(
|
|
1056
|
+
this.#progress.start(
|
|
1057
|
+
options.totalSpecsDefined - options.numExcludedSpecs
|
|
1058
|
+
);
|
|
1035
1059
|
}
|
|
1036
1060
|
|
|
1037
1061
|
suiteStarted(result) {
|
|
@@ -1101,32 +1125,26 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1101
1125
|
);
|
|
1102
1126
|
summary.addResults(this.#stateBuilder.topResults);
|
|
1103
1127
|
results.appendChild(summary.rootEl);
|
|
1128
|
+
const perf = new j$.private.PerformanceView();
|
|
1129
|
+
perf.addResults(this.#stateBuilder.topResults);
|
|
1130
|
+
results.appendChild(perf.rootEl);
|
|
1131
|
+
this.#tabBar.showTab(specListTabId);
|
|
1132
|
+
this.#tabBar.showTab(perfTabId);
|
|
1104
1133
|
|
|
1105
1134
|
if (this.#stateBuilder.anyNonTopSuiteFailures) {
|
|
1106
|
-
this.#
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
);
|
|
1110
|
-
|
|
1111
|
-
this.#setMenuModeTo('jasmine-failure-list');
|
|
1112
|
-
this.#failures.show();
|
|
1135
|
+
this.#tabBar.showTab(failuresTabId);
|
|
1136
|
+
this.#tabBar.selectTab(failuresTabId);
|
|
1137
|
+
} else {
|
|
1138
|
+
this.#tabBar.selectTab(specListTabId);
|
|
1113
1139
|
}
|
|
1114
1140
|
}
|
|
1115
1141
|
|
|
1116
1142
|
#find(selector) {
|
|
1117
|
-
return this.#
|
|
1143
|
+
return this.#container.querySelector(
|
|
1118
1144
|
'.jasmine_html-reporter ' + selector
|
|
1119
1145
|
);
|
|
1120
1146
|
}
|
|
1121
1147
|
|
|
1122
|
-
#clearPrior() {
|
|
1123
|
-
const oldReporter = this.#find('');
|
|
1124
|
-
|
|
1125
|
-
if (oldReporter) {
|
|
1126
|
-
this.#getContainer().removeChild(oldReporter);
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
1148
|
#setMenuModeTo(mode) {
|
|
1131
1149
|
this.#htmlReporterMain.setAttribute(
|
|
1132
1150
|
'class',
|
|
@@ -1145,10 +1163,11 @@ jasmineRequire.HtmlReporterV2 = function(j$) {
|
|
|
1145
1163
|
}
|
|
1146
1164
|
|
|
1147
1165
|
specDone(result) {
|
|
1148
|
-
|
|
1166
|
+
if (result.status !== 'excluded') {
|
|
1167
|
+
this.rootEl.value = this.rootEl.value + 1;
|
|
1168
|
+
}
|
|
1149
1169
|
|
|
1150
1170
|
if (result.status === 'failed') {
|
|
1151
|
-
// TODO: also a non-color indicator
|
|
1152
1171
|
this.rootEl.classList.add('failed');
|
|
1153
1172
|
}
|
|
1154
1173
|
}
|
|
@@ -1233,7 +1252,10 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
|
|
1233
1252
|
}
|
|
1234
1253
|
|
|
1235
1254
|
/**
|
|
1236
|
-
* Creates a {@link Configuration} from the current page's URL.
|
|
1255
|
+
* Creates a {@link Configuration} from the current page's URL. Supported
|
|
1256
|
+
* query string parameters include all those set by {@link HtmlReporterV2}
|
|
1257
|
+
* as well as spec=partialPath, which filters out specs whose paths don't
|
|
1258
|
+
* contain partialPath.
|
|
1237
1259
|
* @returns {Configuration}
|
|
1238
1260
|
* @example
|
|
1239
1261
|
* const urls = new jasmine.HtmlReporterV2Urls();
|
|
@@ -1259,9 +1281,10 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
|
|
1259
1281
|
}
|
|
1260
1282
|
|
|
1261
1283
|
const specFilter = new j$.private.HtmlSpecFilterV2({
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1284
|
+
filterParams: () => ({
|
|
1285
|
+
path: this.queryString.getParam('path'),
|
|
1286
|
+
spec: this.queryString.getParam('spec')
|
|
1287
|
+
})
|
|
1265
1288
|
});
|
|
1266
1289
|
|
|
1267
1290
|
config.specFilter = function(spec) {
|
|
@@ -1281,35 +1304,35 @@ jasmineRequire.HtmlReporterV2Urls = function(j$) {
|
|
|
1281
1304
|
|
|
1282
1305
|
jasmineRequire.HtmlSpecFilterV2 = function() {
|
|
1283
1306
|
class HtmlSpecFilterV2 {
|
|
1284
|
-
#
|
|
1307
|
+
#getFilterParams;
|
|
1285
1308
|
|
|
1286
1309
|
constructor(options) {
|
|
1287
|
-
this.#
|
|
1310
|
+
this.#getFilterParams = options.filterParams;
|
|
1288
1311
|
}
|
|
1289
1312
|
|
|
1290
|
-
/**
|
|
1291
|
-
* Determines whether the spec with the specified name should be executed.
|
|
1292
|
-
* @name HtmlSpecFilterV2#matches
|
|
1293
|
-
* @function
|
|
1294
|
-
* @param {Spec} spec
|
|
1295
|
-
* @returns {boolean}
|
|
1296
|
-
*/
|
|
1297
1313
|
matches(spec) {
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
if (
|
|
1301
|
-
return
|
|
1314
|
+
const params = this.#getFilterParams();
|
|
1315
|
+
|
|
1316
|
+
if (params.path) {
|
|
1317
|
+
return this.#matchesPath(spec, JSON.parse(params.path));
|
|
1318
|
+
} else if (params.spec) {
|
|
1319
|
+
// Like legacy HtmlSpecFilter, retained because it's convenient for
|
|
1320
|
+
// hand-constructing filter URLs
|
|
1321
|
+
return spec.getFullName().includes(params.spec);
|
|
1302
1322
|
}
|
|
1303
1323
|
|
|
1304
|
-
|
|
1324
|
+
return true;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
#matchesPath(spec, path) {
|
|
1305
1328
|
const specPath = spec.getPath();
|
|
1306
1329
|
|
|
1307
|
-
if (
|
|
1330
|
+
if (path.length > specPath.length) {
|
|
1308
1331
|
return false;
|
|
1309
1332
|
}
|
|
1310
1333
|
|
|
1311
|
-
for (let i = 0; i <
|
|
1312
|
-
if (specPath[i] !==
|
|
1334
|
+
for (let i = 0; i < path.length; i++) {
|
|
1335
|
+
if (specPath[i] !== path[i]) {
|
|
1313
1336
|
return false;
|
|
1314
1337
|
}
|
|
1315
1338
|
}
|
|
@@ -1430,6 +1453,105 @@ jasmineRequire.OverallStatusBar = function(j$) {
|
|
|
1430
1453
|
return OverallStatusBar;
|
|
1431
1454
|
};
|
|
1432
1455
|
|
|
1456
|
+
jasmineRequire.PerformanceView = function(j$) {
|
|
1457
|
+
const createDom = j$.private.htmlReporterUtils.createDom;
|
|
1458
|
+
const MAX_SLOW_SPECS = 20;
|
|
1459
|
+
|
|
1460
|
+
class PerformanceView {
|
|
1461
|
+
#summary;
|
|
1462
|
+
#tbody;
|
|
1463
|
+
|
|
1464
|
+
constructor() {
|
|
1465
|
+
this.#tbody = document.createElement('tbody');
|
|
1466
|
+
this.#summary = document.createElement('div');
|
|
1467
|
+
this.rootEl = createDom(
|
|
1468
|
+
'div',
|
|
1469
|
+
{ className: 'jasmine-performance-view' },
|
|
1470
|
+
createDom('h2', {}, 'Performance'),
|
|
1471
|
+
this.#summary,
|
|
1472
|
+
createDom('h3', {}, 'Slowest Specs'),
|
|
1473
|
+
createDom(
|
|
1474
|
+
'table',
|
|
1475
|
+
{},
|
|
1476
|
+
createDom(
|
|
1477
|
+
'thead',
|
|
1478
|
+
{},
|
|
1479
|
+
createDom(
|
|
1480
|
+
'tr',
|
|
1481
|
+
{},
|
|
1482
|
+
createDom('th', {}, 'Duration'),
|
|
1483
|
+
createDom('th', {}, 'Spec Name')
|
|
1484
|
+
)
|
|
1485
|
+
),
|
|
1486
|
+
this.#tbody
|
|
1487
|
+
)
|
|
1488
|
+
);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
addResults(resultsTree) {
|
|
1492
|
+
const specResults = [];
|
|
1493
|
+
getSpecResults(resultsTree, specResults);
|
|
1494
|
+
|
|
1495
|
+
if (specResults.length === 0) {
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
specResults.sort(function(a, b) {
|
|
1500
|
+
if (a.duration < b.duration) {
|
|
1501
|
+
return 1;
|
|
1502
|
+
} else if (a.duration > b.duration) {
|
|
1503
|
+
return -1;
|
|
1504
|
+
} else {
|
|
1505
|
+
return 0;
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1509
|
+
this.#populateSumary(specResults);
|
|
1510
|
+
this.#populateTable(specResults);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
#populateSumary(specResults) {
|
|
1514
|
+
const total = specResults.map(r => r.duration).reduce((a, b) => a + b, 0);
|
|
1515
|
+
const mean = total / specResults.length;
|
|
1516
|
+
const median = specResults[Math.floor(specResults.length / 2)].duration;
|
|
1517
|
+
this.#summary.appendChild(
|
|
1518
|
+
document.createTextNode(`Mean spec run time: ${mean.toFixed(0)}ms`)
|
|
1519
|
+
);
|
|
1520
|
+
this.#summary.appendChild(document.createElement('br'));
|
|
1521
|
+
this.#summary.appendChild(
|
|
1522
|
+
document.createTextNode(`Median spec run time: ${median}ms`)
|
|
1523
|
+
);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
#populateTable(specResults) {
|
|
1527
|
+
specResults = specResults.slice(0, MAX_SLOW_SPECS);
|
|
1528
|
+
|
|
1529
|
+
for (const r of specResults) {
|
|
1530
|
+
this.#tbody.appendChild(
|
|
1531
|
+
createDom(
|
|
1532
|
+
'tr',
|
|
1533
|
+
{},
|
|
1534
|
+
createDom('td', {}, `${r.duration}ms`),
|
|
1535
|
+
createDom('td', {}, r.fullName)
|
|
1536
|
+
)
|
|
1537
|
+
);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
function getSpecResults(resultsTree, dest) {
|
|
1543
|
+
for (const node of resultsTree.children) {
|
|
1544
|
+
if (node.type === 'suite') {
|
|
1545
|
+
getSpecResults(node, dest);
|
|
1546
|
+
} else if (node.result.status !== 'excluded') {
|
|
1547
|
+
dest.push(node.result);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
return PerformanceView;
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1433
1555
|
jasmineRequire.ResultsStateBuilder = function(j$) {
|
|
1434
1556
|
'use strict';
|
|
1435
1557
|
|
|
@@ -1661,3 +1783,81 @@ jasmineRequire.SymbolsView = function(j$) {
|
|
|
1661
1783
|
|
|
1662
1784
|
return SymbolsView;
|
|
1663
1785
|
};
|
|
1786
|
+
|
|
1787
|
+
jasmineRequire.TabBar = function(j$) {
|
|
1788
|
+
const createDom = j$.private.htmlReporterUtils.createDom;
|
|
1789
|
+
|
|
1790
|
+
class TabBar {
|
|
1791
|
+
#tabs;
|
|
1792
|
+
#onSelectTab;
|
|
1793
|
+
|
|
1794
|
+
// tabSpecs should be an array of {id, label}.
|
|
1795
|
+
// All tabs are initially not visible and not selected.
|
|
1796
|
+
constructor(tabSpecs, onSelectTab) {
|
|
1797
|
+
this.#onSelectTab = onSelectTab;
|
|
1798
|
+
this.#tabs = [];
|
|
1799
|
+
this.#tabs = tabSpecs.map(ts => new Tab(ts, () => this.selectTab(ts.id)));
|
|
1800
|
+
|
|
1801
|
+
this.rootEl = createDom(
|
|
1802
|
+
'span',
|
|
1803
|
+
{ className: 'jasmine-menu jasmine-bar' },
|
|
1804
|
+
this.#tabs.map(t => t.rootEl)
|
|
1805
|
+
);
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
showTab(id) {
|
|
1809
|
+
for (const tab of this.#tabs) {
|
|
1810
|
+
if (tab.rootEl.id === id) {
|
|
1811
|
+
tab.setVisibility(true);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
selectTab(id) {
|
|
1817
|
+
for (const tab of this.#tabs) {
|
|
1818
|
+
tab.setSelected(tab.rootEl.id === id);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
this.#onSelectTab(id);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
class Tab {
|
|
1826
|
+
#spec;
|
|
1827
|
+
#onClick;
|
|
1828
|
+
|
|
1829
|
+
constructor(spec, onClick) {
|
|
1830
|
+
this.#spec = spec;
|
|
1831
|
+
this.#onClick = onClick;
|
|
1832
|
+
this.rootEl = createDom(
|
|
1833
|
+
'span',
|
|
1834
|
+
{ id: spec.id, className: 'jasmine-tab jasmine-hidden' },
|
|
1835
|
+
this.#createLink()
|
|
1836
|
+
);
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
setVisibility(visible) {
|
|
1840
|
+
this.rootEl.classList.toggle('jasmine-hidden', !visible);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
setSelected(selected) {
|
|
1844
|
+
if (selected) {
|
|
1845
|
+
this.rootEl.textContent = this.#spec.label;
|
|
1846
|
+
} else {
|
|
1847
|
+
this.rootEl.textContent = '';
|
|
1848
|
+
this.rootEl.appendChild(this.#createLink());
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
#createLink() {
|
|
1853
|
+
const link = createDom('a', { href: '#' }, this.#spec.label);
|
|
1854
|
+
link.addEventListener('click', e => {
|
|
1855
|
+
e.preventDefault();
|
|
1856
|
+
this.#onClick();
|
|
1857
|
+
});
|
|
1858
|
+
return link;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
return TabBar;
|
|
1863
|
+
};
|
|
@@ -8,7 +8,7 @@ body {
|
|
|
8
8
|
background-color: #eee;
|
|
9
9
|
padding: 5px;
|
|
10
10
|
margin: -8px;
|
|
11
|
-
font-size:
|
|
11
|
+
font-size: 12px;
|
|
12
12
|
font-family: Monaco, "Lucida Console", monospace;
|
|
13
13
|
line-height: 14px;
|
|
14
14
|
color: #333;
|
|
@@ -63,7 +63,7 @@ body {
|
|
|
63
63
|
float: right;
|
|
64
64
|
line-height: 28px;
|
|
65
65
|
padding-right: 9px;
|
|
66
|
-
font-size:
|
|
66
|
+
font-size: 12px;
|
|
67
67
|
}
|
|
68
68
|
.jasmine_html-reporter .jasmine-symbol-summary {
|
|
69
69
|
overflow: hidden;
|
|
@@ -198,11 +198,17 @@ body {
|
|
|
198
198
|
color: white;
|
|
199
199
|
}
|
|
200
200
|
.jasmine_html-reporter.jasmine-spec-list .jasmine-bar.jasmine-menu.jasmine-failure-list,
|
|
201
|
-
.jasmine_html-reporter.jasmine-spec-list .jasmine-results .jasmine-failures
|
|
201
|
+
.jasmine_html-reporter.jasmine-spec-list .jasmine-results .jasmine-failures,
|
|
202
|
+
.jasmine_html-reporter.jasmine-spec-list .jasmine-performance-view {
|
|
202
203
|
display: none;
|
|
203
204
|
}
|
|
204
205
|
.jasmine_html-reporter.jasmine-failure-list .jasmine-bar.jasmine-menu.jasmine-spec-list,
|
|
205
|
-
.jasmine_html-reporter.jasmine-failure-list .jasmine-summary
|
|
206
|
+
.jasmine_html-reporter.jasmine-failure-list .jasmine-summary,
|
|
207
|
+
.jasmine_html-reporter.jasmine-failure-list .jasmine-performance-view {
|
|
208
|
+
display: none;
|
|
209
|
+
}
|
|
210
|
+
.jasmine_html-reporter.jasmine-performance .jasmine-results .jasmine-failures,
|
|
211
|
+
.jasmine_html-reporter.jasmine-performance .jasmine-summary {
|
|
206
212
|
display: none;
|
|
207
213
|
}
|
|
208
214
|
.jasmine_html-reporter .jasmine-results {
|
|
@@ -323,4 +329,23 @@ body {
|
|
|
323
329
|
}
|
|
324
330
|
.jasmine_html-reporter .jasmine-debug-log .jasmine-debug-log-msg {
|
|
325
331
|
white-space: pre;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.jasmine-hidden {
|
|
335
|
+
display: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.jasmine-tab + .jasmine-tab:before {
|
|
339
|
+
content: " | ";
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.jasmine-performance-view h2, .jasmine-performance-view h3 {
|
|
343
|
+
margin-top: 1em;
|
|
344
|
+
margin-bottom: 1em;
|
|
345
|
+
}
|
|
346
|
+
.jasmine-performance-view table {
|
|
347
|
+
border-spacing: 5px;
|
|
348
|
+
}
|
|
349
|
+
.jasmine-performance-view th, .jasmine-performance-view td {
|
|
350
|
+
text-align: left;
|
|
326
351
|
}
|