teaspoon-qunit 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/teaspoon/qunit/assets/qunit/1.19.0.js +3963 -0
- data/lib/teaspoon/qunit/assets/teaspoon-qunit.js +208 -93
- data/lib/teaspoon/qunit/assets/teaspoon/qunit/spec.coffee +2 -2
- data/lib/teaspoon/qunit/assets/teaspoon/qunit/suite.coffee +2 -9
- data/lib/teaspoon/qunit/framework.rb +1 -1
- data/lib/teaspoon/qunit/templates/test_helper.coffee +1 -1
- data/lib/teaspoon/qunit/templates/test_helper.js +1 -1
- data/lib/teaspoon/qunit/version.rb +1 -1
- data/spec/console_spec.rb +17 -14
- data/spec/installation_spec.rb +8 -5
- data/test/javascripts/qunit/spec_test.coffee +6 -1
- data/test/javascripts/qunit/suite_test.coffee +6 -1
- data/test/teaspoon_env.rb +1 -1
- metadata +4 -3
@@ -80,7 +80,7 @@
|
|
80
80
|
var e;
|
81
81
|
Teaspoon.messages.push(arguments[0]);
|
82
82
|
try {
|
83
|
-
return console.log.apply(console, arguments);
|
83
|
+
return typeof console !== "undefined" && console !== null ? typeof console.log === "function" ? console.log.apply(console, arguments) : void 0 : void 0;
|
84
84
|
} catch (_error) {
|
85
85
|
e = _error;
|
86
86
|
throw new Error("Unable to use console.log for logging");
|
@@ -126,6 +126,46 @@
|
|
126
126
|
|
127
127
|
})();
|
128
128
|
|
129
|
+
}).call(this);
|
130
|
+
(function() {
|
131
|
+
Teaspoon.Mixins || (Teaspoon.Mixins = {});
|
132
|
+
|
133
|
+
}).call(this);
|
134
|
+
(function() {
|
135
|
+
Teaspoon.Mixins.FilterUrl = {
|
136
|
+
filterUrl: function(grep) {
|
137
|
+
var params;
|
138
|
+
params = [];
|
139
|
+
params.push("grep=" + (encodeURIComponent(grep)));
|
140
|
+
if (Teaspoon.params.file) {
|
141
|
+
params.push("file=" + Teaspoon.params.file);
|
142
|
+
}
|
143
|
+
return "?" + (params.join("&"));
|
144
|
+
}
|
145
|
+
};
|
146
|
+
|
147
|
+
}).call(this);
|
148
|
+
(function() {
|
149
|
+
Teaspoon.Utility = (function() {
|
150
|
+
function Utility() {}
|
151
|
+
|
152
|
+
Utility.extend = function(obj, mixin) {
|
153
|
+
var method, name;
|
154
|
+
for (name in mixin) {
|
155
|
+
method = mixin[name];
|
156
|
+
obj[name] = method;
|
157
|
+
}
|
158
|
+
return obj;
|
159
|
+
};
|
160
|
+
|
161
|
+
Utility.include = function(klass, mixin) {
|
162
|
+
return this.extend(klass.prototype, mixin);
|
163
|
+
};
|
164
|
+
|
165
|
+
return Utility;
|
166
|
+
|
167
|
+
})();
|
168
|
+
|
129
169
|
}).call(this);
|
130
170
|
(function() {
|
131
171
|
Teaspoon.Runner = (function() {
|
@@ -180,7 +220,7 @@
|
|
180
220
|
var slice = [].slice;
|
181
221
|
|
182
222
|
Teaspoon.Fixture = (function() {
|
183
|
-
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
|
223
|
+
var addContent, cleanup, create, jQueryAvailable, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
|
184
224
|
|
185
225
|
Fixture.cache = {};
|
186
226
|
|
@@ -191,19 +231,19 @@
|
|
191
231
|
Fixture.json = [];
|
192
232
|
|
193
233
|
Fixture.preload = function() {
|
194
|
-
var
|
234
|
+
var j, len, results, url, urls;
|
195
235
|
urls = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
196
236
|
results = [];
|
197
|
-
for (
|
198
|
-
url = urls[
|
237
|
+
for (j = 0, len = urls.length; j < len; j++) {
|
238
|
+
url = urls[j];
|
199
239
|
results.push(preload(url));
|
200
240
|
}
|
201
241
|
return results;
|
202
242
|
};
|
203
243
|
|
204
244
|
Fixture.load = function() {
|
205
|
-
var append,
|
206
|
-
urls = 2 <= arguments.length ? slice.call(arguments, 0,
|
245
|
+
var append, index, j, k, len, results, url, urls;
|
246
|
+
urls = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), append = arguments[j++];
|
207
247
|
if (append == null) {
|
208
248
|
append = false;
|
209
249
|
}
|
@@ -212,7 +252,7 @@
|
|
212
252
|
append = false;
|
213
253
|
}
|
214
254
|
results = [];
|
215
|
-
for (index =
|
255
|
+
for (index = k = 0, len = urls.length; k < len; index = ++k) {
|
216
256
|
url = urls[index];
|
217
257
|
results.push(load(url, append || index > 0));
|
218
258
|
}
|
@@ -220,8 +260,8 @@
|
|
220
260
|
};
|
221
261
|
|
222
262
|
Fixture.set = function() {
|
223
|
-
var append, html, htmls,
|
224
|
-
htmls = 2 <= arguments.length ? slice.call(arguments, 0,
|
263
|
+
var append, html, htmls, index, j, k, len, results;
|
264
|
+
htmls = 2 <= arguments.length ? slice.call(arguments, 0, j = arguments.length - 1) : (j = 0, []), append = arguments[j++];
|
225
265
|
if (append == null) {
|
226
266
|
append = false;
|
227
267
|
}
|
@@ -230,7 +270,7 @@
|
|
230
270
|
append = false;
|
231
271
|
}
|
232
272
|
results = [];
|
233
|
-
for (index =
|
273
|
+
for (index = k = 0, len = htmls.length; k < len; index = ++k) {
|
234
274
|
html = htmls[index];
|
235
275
|
results.push(set(html, append || index > 0));
|
236
276
|
}
|
@@ -301,21 +341,30 @@
|
|
301
341
|
|
302
342
|
putContent = function(content) {
|
303
343
|
cleanup();
|
304
|
-
|
305
|
-
return window.fixture.el.innerHTML = content;
|
344
|
+
return addContent(content);
|
306
345
|
};
|
307
346
|
|
308
347
|
addContent = function(content) {
|
348
|
+
var i, j, parsed, ref, results;
|
309
349
|
if (!window.fixture.el) {
|
310
350
|
create();
|
311
351
|
}
|
312
|
-
|
352
|
+
if (jQueryAvailable()) {
|
353
|
+
parsed = $($.parseHTML(content, document, true));
|
354
|
+
results = [];
|
355
|
+
for (i = j = 0, ref = parsed.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
356
|
+
results.push(window.fixture.el.appendChild(parsed[i]));
|
357
|
+
}
|
358
|
+
return results;
|
359
|
+
} else {
|
360
|
+
return window.fixture.el.innerHTML += content;
|
361
|
+
}
|
313
362
|
};
|
314
363
|
|
315
364
|
create = function() {
|
316
365
|
var ref;
|
317
366
|
window.fixture.el = document.createElement("div");
|
318
|
-
if (
|
367
|
+
if (jQueryAvailable()) {
|
319
368
|
window.fixture.$el = $(window.fixture.el);
|
320
369
|
}
|
321
370
|
window.fixture.el.id = "teaspoon-fixtures";
|
@@ -357,6 +406,10 @@
|
|
357
406
|
return xhr.send();
|
358
407
|
};
|
359
408
|
|
409
|
+
jQueryAvailable = function() {
|
410
|
+
return typeof window.$ === 'function';
|
411
|
+
};
|
412
|
+
|
360
413
|
return Fixture;
|
361
414
|
|
362
415
|
})();
|
@@ -405,6 +458,28 @@
|
|
405
458
|
});
|
406
459
|
};
|
407
460
|
|
461
|
+
}).call(this);
|
462
|
+
(function() {
|
463
|
+
Teaspoon.Spec = (function() {
|
464
|
+
function Spec() {}
|
465
|
+
|
466
|
+
Teaspoon.Utility.include(Spec, Teaspoon.Mixins.FilterUrl);
|
467
|
+
|
468
|
+
return Spec;
|
469
|
+
|
470
|
+
})();
|
471
|
+
|
472
|
+
}).call(this);
|
473
|
+
(function() {
|
474
|
+
Teaspoon.Suite = (function() {
|
475
|
+
function Suite() {}
|
476
|
+
|
477
|
+
Teaspoon.Utility.include(Suite, Teaspoon.Mixins.FilterUrl);
|
478
|
+
|
479
|
+
return Suite;
|
480
|
+
|
481
|
+
})();
|
482
|
+
|
408
483
|
}).call(this);
|
409
484
|
(function() {
|
410
485
|
Teaspoon.Reporters.BaseView = (function() {
|
@@ -547,7 +622,7 @@
|
|
547
622
|
this.setText("stats-passes", this.total.passes);
|
548
623
|
this.setText("stats-failures", this.total.failures);
|
549
624
|
if (this.total.run < this.total.exist) {
|
550
|
-
this.total.skipped = this.total.exist - this.total.run;
|
625
|
+
this.total.skipped = this.total.exist - this.total.run + this.total.skipped;
|
551
626
|
this.total.run = this.total.exist;
|
552
627
|
}
|
553
628
|
this.setText("stats-skipped", this.total.skipped);
|
@@ -568,7 +643,8 @@
|
|
568
643
|
HTML.prototype.reportSpecResults = function(spec) {
|
569
644
|
this.total.run += 1;
|
570
645
|
this.updateProgress();
|
571
|
-
|
646
|
+
this.updateStatus(spec);
|
647
|
+
return delete this.reportView;
|
572
648
|
};
|
573
649
|
|
574
650
|
HTML.prototype.buildLayout = function() {
|
@@ -623,27 +699,24 @@
|
|
623
699
|
};
|
624
700
|
|
625
701
|
HTML.prototype.updateStatus = function(spec) {
|
626
|
-
var elapsed, ref,
|
627
|
-
result = spec.result();
|
628
|
-
if (result.skipped) {
|
629
|
-
this.updateStat("skipped", this.total.skipped += 1);
|
630
|
-
return;
|
631
|
-
}
|
702
|
+
var elapsed, ref, result;
|
632
703
|
elapsed = new Teaspoon.Date().getTime() - this.specStart;
|
633
|
-
if (
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
704
|
+
if ((ref = this.reportView) != null) {
|
705
|
+
ref.updateState(spec, elapsed);
|
706
|
+
}
|
707
|
+
result = spec.result();
|
708
|
+
if (result.status === "pending") {
|
709
|
+
return this.updateStat("skipped", this.total.skipped += 1);
|
710
|
+
} else if (result.status === "failed") {
|
639
711
|
this.updateStat("failures", this.total.failures += 1);
|
640
|
-
if ((ref2 = this.reportView) != null) {
|
641
|
-
ref2.updateState("failed", elapsed);
|
642
|
-
}
|
643
712
|
if (!this.config["build-full-report"]) {
|
644
713
|
new (Teaspoon.resolveClass("Reporters.HTML.FailureView"))(spec).appendTo(this.findEl("report-failures"));
|
645
714
|
}
|
646
715
|
return this.setStatus("failed");
|
716
|
+
} else if (result.skipped) {
|
717
|
+
return this.updateStat("skipped", this.total.skipped += 1);
|
718
|
+
} else {
|
719
|
+
return this.updateStat("passes", this.total.passes += 1);
|
647
720
|
}
|
648
721
|
};
|
649
722
|
|
@@ -896,8 +969,8 @@
|
|
896
969
|
|
897
970
|
viewId = 0;
|
898
971
|
|
899
|
-
function SpecView(
|
900
|
-
this.spec =
|
972
|
+
function SpecView(spec1, reporter) {
|
973
|
+
this.spec = spec1;
|
901
974
|
this.reporter = reporter;
|
902
975
|
this.views = this.reporter.views;
|
903
976
|
this.spec.viewId = viewId += 1;
|
@@ -920,6 +993,9 @@
|
|
920
993
|
SpecView.prototype.buildParent = function() {
|
921
994
|
var parent, view;
|
922
995
|
parent = this.spec.parent;
|
996
|
+
if (!parent) {
|
997
|
+
return this.reporter;
|
998
|
+
}
|
923
999
|
if (parent.viewId) {
|
924
1000
|
return this.views.suites[parent.viewId];
|
925
1001
|
} else {
|
@@ -941,21 +1017,52 @@
|
|
941
1017
|
return this.append(div);
|
942
1018
|
};
|
943
1019
|
|
944
|
-
SpecView.prototype.updateState = function(
|
945
|
-
var
|
946
|
-
result =
|
947
|
-
|
948
|
-
if (
|
949
|
-
|
950
|
-
}
|
951
|
-
|
952
|
-
|
1020
|
+
SpecView.prototype.updateState = function(spec, elapsed) {
|
1021
|
+
var result;
|
1022
|
+
result = spec.result();
|
1023
|
+
this.clearClasses();
|
1024
|
+
if (result.status === "pending") {
|
1025
|
+
return this.updatePending(spec, elapsed);
|
1026
|
+
} else if (result.status === "failed") {
|
1027
|
+
return this.updateFailed(spec, elapsed);
|
1028
|
+
} else if (result.skipped) {
|
1029
|
+
return this.updateDisabled(spec, elapsed);
|
1030
|
+
} else {
|
1031
|
+
return this.updatePassed(spec, elapsed);
|
953
1032
|
}
|
954
|
-
|
955
|
-
|
956
|
-
|
1033
|
+
};
|
1034
|
+
|
1035
|
+
SpecView.prototype.updatePassed = function(spec, elapsed) {
|
1036
|
+
this.addStatusClass("passed");
|
1037
|
+
if (elapsed > Teaspoon.slow) {
|
1038
|
+
this.addClass("slow");
|
957
1039
|
}
|
958
|
-
return
|
1040
|
+
return this.el.innerHTML += "<span>" + elapsed + "ms</span>";
|
1041
|
+
};
|
1042
|
+
|
1043
|
+
SpecView.prototype.updateFailed = function(spec, elapsed) {
|
1044
|
+
var base;
|
1045
|
+
this.addStatusClass("failed");
|
1046
|
+
this.buildErrors();
|
1047
|
+
return typeof (base = this.parentView).updateState === "function" ? base.updateState("failed") : void 0;
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
SpecView.prototype.updatePending = function(spec, elapsed) {
|
1051
|
+
return this.addStatusClass("pending");
|
1052
|
+
};
|
1053
|
+
|
1054
|
+
SpecView.prototype.updateDisabled = function(spec, elapsed) {};
|
1055
|
+
|
1056
|
+
SpecView.prototype.clearClasses = function() {
|
1057
|
+
return this.el.className = "";
|
1058
|
+
};
|
1059
|
+
|
1060
|
+
SpecView.prototype.addStatusClass = function(status) {
|
1061
|
+
return this.addClass("state-" + status);
|
1062
|
+
};
|
1063
|
+
|
1064
|
+
SpecView.prototype.addClass = function(name) {
|
1065
|
+
return this.el.className += " " + name;
|
959
1066
|
};
|
960
1067
|
|
961
1068
|
return SpecView;
|
@@ -1091,52 +1198,45 @@
|
|
1091
1198
|
var result;
|
1092
1199
|
this.spec = spec1;
|
1093
1200
|
result = this.spec.result();
|
1094
|
-
if (result.
|
1095
|
-
return;
|
1201
|
+
if (result.status === "pending") {
|
1202
|
+
return this.trackPending(this.spec);
|
1203
|
+
} else if (result.status === "failed") {
|
1204
|
+
return this.trackFailed(this.spec);
|
1205
|
+
} else if (result.skipped) {
|
1206
|
+
return this.trackDisabled(this.spec);
|
1207
|
+
} else {
|
1208
|
+
return this.trackPassed(this.spec);
|
1096
1209
|
}
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
return this.trackPending();
|
1101
|
-
case "failed":
|
1102
|
-
return this.trackFailure();
|
1103
|
-
default:
|
1104
|
-
return this.log({
|
1105
|
-
type: "spec",
|
1106
|
-
suite: this.spec.suiteName,
|
1107
|
-
label: this.spec.description,
|
1108
|
-
status: result.status,
|
1109
|
-
skipped: result.skipped
|
1110
|
-
});
|
1111
|
-
}
|
1112
|
-
};
|
1113
|
-
|
1114
|
-
Console.prototype.trackPending = function() {
|
1210
|
+
};
|
1211
|
+
|
1212
|
+
Console.prototype.trackPending = function(spec) {
|
1115
1213
|
var result;
|
1116
|
-
|
1214
|
+
this.reportSuites();
|
1215
|
+
result = spec.result();
|
1117
1216
|
return this.log({
|
1118
1217
|
type: "spec",
|
1119
|
-
suite:
|
1120
|
-
label:
|
1218
|
+
suite: spec.suiteName,
|
1219
|
+
label: spec.description,
|
1121
1220
|
status: result.status,
|
1122
1221
|
skipped: result.skipped
|
1123
1222
|
});
|
1124
1223
|
};
|
1125
1224
|
|
1126
|
-
Console.prototype.
|
1225
|
+
Console.prototype.trackFailed = function(spec) {
|
1127
1226
|
var error, i, len, ref, result, results;
|
1128
|
-
|
1129
|
-
|
1227
|
+
this.reportSuites();
|
1228
|
+
result = spec.result();
|
1229
|
+
ref = spec.errors();
|
1130
1230
|
results = [];
|
1131
1231
|
for (i = 0, len = ref.length; i < len; i++) {
|
1132
1232
|
error = ref[i];
|
1133
1233
|
results.push(this.log({
|
1134
1234
|
type: "spec",
|
1135
|
-
suite:
|
1136
|
-
label:
|
1235
|
+
suite: spec.suiteName,
|
1236
|
+
label: spec.description,
|
1137
1237
|
status: result.status,
|
1138
1238
|
skipped: result.skipped,
|
1139
|
-
link:
|
1239
|
+
link: spec.fullDescription,
|
1140
1240
|
message: error.message,
|
1141
1241
|
trace: error.stack || error.message || "Stack Trace Unavailable"
|
1142
1242
|
}));
|
@@ -1144,6 +1244,20 @@
|
|
1144
1244
|
return results;
|
1145
1245
|
};
|
1146
1246
|
|
1247
|
+
Console.prototype.trackDisabled = function(spec) {};
|
1248
|
+
|
1249
|
+
Console.prototype.trackPassed = function(spec, result) {
|
1250
|
+
this.reportSuites();
|
1251
|
+
result = spec.result();
|
1252
|
+
return this.log({
|
1253
|
+
type: "spec",
|
1254
|
+
suite: spec.suiteName,
|
1255
|
+
label: spec.description,
|
1256
|
+
status: result.status,
|
1257
|
+
skipped: result.skipped
|
1258
|
+
});
|
1259
|
+
};
|
1260
|
+
|
1147
1261
|
Console.prototype.log = function(obj) {
|
1148
1262
|
if (obj == null) {
|
1149
1263
|
obj = {};
|
@@ -1424,12 +1538,17 @@
|
|
1424
1538
|
|
1425
1539
|
}).call(this);
|
1426
1540
|
(function() {
|
1427
|
-
|
1541
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
1542
|
+
hasProp = {}.hasOwnProperty;
|
1543
|
+
|
1544
|
+
Teaspoon.Qunit.Spec = (function(superClass) {
|
1545
|
+
extend(Spec, superClass);
|
1546
|
+
|
1428
1547
|
function Spec(spec1) {
|
1429
1548
|
this.spec = spec1;
|
1430
1549
|
this.fullDescription = this.spec.module + " " + this.spec.name;
|
1431
1550
|
this.description = this.spec.name + " (" + this.spec.failed + ", " + this.spec.passed + ", " + this.spec.total + ")";
|
1432
|
-
this.link =
|
1551
|
+
this.link = this.filterUrl(this.spec.module + ": " + this.spec.name);
|
1433
1552
|
this.parent = this.spec.module ? new Teaspoon.Qunit.Suite({
|
1434
1553
|
description: this.spec.module
|
1435
1554
|
}) : null;
|
@@ -1491,7 +1610,7 @@
|
|
1491
1610
|
|
1492
1611
|
return Spec;
|
1493
1612
|
|
1494
|
-
})();
|
1613
|
+
})(Teaspoon.Spec);
|
1495
1614
|
|
1496
1615
|
Teaspoon.Spec = (function() {
|
1497
1616
|
function Spec(spec) {
|
@@ -1504,26 +1623,22 @@
|
|
1504
1623
|
|
1505
1624
|
}).call(this);
|
1506
1625
|
(function() {
|
1507
|
-
|
1508
|
-
|
1509
|
-
this.suite = suite1;
|
1510
|
-
this.fullDescription = this.suite.description || this.suite.name;
|
1511
|
-
this.description = this.suite.description || this.suite.name;
|
1512
|
-
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
1513
|
-
this.parent = null;
|
1514
|
-
}
|
1515
|
-
|
1516
|
-
return Suite;
|
1626
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
1627
|
+
hasProp = {}.hasOwnProperty;
|
1517
1628
|
|
1518
|
-
|
1629
|
+
Teaspoon.Qunit.Suite = (function(superClass) {
|
1630
|
+
extend(Suite, superClass);
|
1519
1631
|
|
1520
|
-
Teaspoon.Suite = (function() {
|
1521
1632
|
function Suite(suite) {
|
1522
|
-
|
1633
|
+
this.suite = suite;
|
1634
|
+
this.fullDescription = this.suite.description || this.suite.name;
|
1635
|
+
this.description = this.suite.description || this.suite.name;
|
1636
|
+
this.link = this.filterUrl(this.fullDescription);
|
1637
|
+
this.parent = null;
|
1523
1638
|
}
|
1524
1639
|
|
1525
1640
|
return Suite;
|
1526
1641
|
|
1527
|
-
})();
|
1642
|
+
})(Teaspoon.Suite);
|
1528
1643
|
|
1529
1644
|
}).call(this);
|