jasmine-core 1.3.1 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jasmine-core.rb +14 -1
- data/lib/jasmine-core/boot.js +131 -0
- data/lib/jasmine-core/boot/boot.js +109 -0
- data/lib/jasmine-core/example/spec/PlayerSpec.js +2 -2
- data/lib/jasmine-core/example/spec/SpecHelper.js +14 -8
- data/lib/jasmine-core/jasmine-html.js +289 -616
- data/lib/jasmine-core/jasmine.css +52 -80
- data/lib/jasmine-core/jasmine.js +1972 -2211
- data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +161 -386
- data/lib/jasmine-core/spec/core/AnySpec.js +45 -0
- data/lib/jasmine-core/spec/core/CallTrackerSpec.js +105 -0
- data/lib/jasmine-core/spec/core/ClockSpec.js +314 -0
- data/lib/jasmine-core/spec/core/CustomMatchersSpec.js +96 -97
- data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +179 -0
- data/lib/jasmine-core/spec/core/EnvSpec.js +454 -102
- data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +56 -0
- data/lib/jasmine-core/spec/core/ExceptionsSpec.js +15 -126
- data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +61 -0
- data/lib/jasmine-core/spec/core/ExpectationSpec.js +320 -0
- data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +150 -38
- data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +64 -0
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +43 -42
- data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +147 -0
- data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +40 -0
- data/lib/jasmine-core/spec/core/SpecRunningSpec.js +92 -1075
- data/lib/jasmine-core/spec/core/SpecSpec.js +215 -95
- data/lib/jasmine-core/spec/core/SpySpec.js +28 -196
- data/lib/jasmine-core/spec/core/SpyStrategySpec.js +101 -0
- data/lib/jasmine-core/spec/core/SuiteSpec.js +216 -106
- data/lib/jasmine-core/spec/core/TimerSpec.js +13 -0
- data/lib/jasmine-core/spec/core/UtilSpec.js +19 -30
- data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +219 -0
- data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +51 -0
- data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +18 -0
- data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +38 -0
- data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +19 -0
- data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +20 -0
- data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +36 -0
- data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +17 -0
- data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +17 -0
- data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +38 -0
- data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +17 -0
- data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +24 -0
- data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +28 -0
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +46 -0
- data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +57 -0
- data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +34 -0
- data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +280 -0
- data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +98 -0
- data/lib/jasmine-core/spec/helpers/BrowserFlags.js +19 -0
- data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +494 -0
- data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +18 -0
- data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +8 -8
- data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +3 -3
- data/lib/jasmine-core/spec/html/QueryStringSpec.js +43 -0
- data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +62 -0
- data/lib/jasmine-core/spec/node_suite.js +137 -79
- data/lib/jasmine-core/spec/performance/performance_test.js +10 -0
- data/lib/jasmine-core/spec/support/dev_boot.js +118 -0
- data/lib/jasmine-core/version.rb +5 -2
- metadata +47 -103
- data/lib/jasmine-core/example/SpecRunner.html +0 -54
- data/lib/jasmine-core/spec/core/BaseSpec.js +0 -27
- data/lib/jasmine-core/spec/core/MatchersSpec.js +0 -1157
- data/lib/jasmine-core/spec/core/MockClockSpec.js +0 -38
- data/lib/jasmine-core/spec/core/MultiReporterSpec.js +0 -45
- data/lib/jasmine-core/spec/core/NestedResultsSpec.js +0 -54
- data/lib/jasmine-core/spec/core/QueueSpec.js +0 -23
- data/lib/jasmine-core/spec/core/ReporterSpec.js +0 -56
- data/lib/jasmine-core/spec/core/RunnerSpec.js +0 -280
- data/lib/jasmine-core/spec/core/WaitsForBlockSpec.js +0 -118
- data/lib/jasmine-core/spec/html/HTMLReporterSpec.js +0 -209
- data/lib/jasmine-core/spec/html/TrivialReporterSpec.js +0 -239
@@ -1,451 +1,226 @@
|
|
1
1
|
describe("ConsoleReporter", function() {
|
2
|
-
|
3
|
-
function green(str) {
|
4
|
-
return '\033[32m' + str + '\033[0m';
|
5
|
-
}
|
6
|
-
|
7
|
-
function red(str) {
|
8
|
-
return '\033[31m' + str + '\033[0m';
|
9
|
-
}
|
10
|
-
|
11
|
-
function yellow(str) {
|
12
|
-
return '\033[33m' + str + '\033[0m';
|
13
|
-
}
|
14
|
-
|
15
|
-
function prefixGreen(str) {
|
16
|
-
return '\033[32m' + str;
|
17
|
-
}
|
18
|
-
|
19
|
-
function prefixRed(str) {
|
20
|
-
return '\033[31m' + str;
|
21
|
-
}
|
22
|
-
|
23
|
-
var newline = "\n";
|
24
|
-
|
25
|
-
var passingSpec = {
|
26
|
-
results: function() {
|
27
|
-
return {
|
28
|
-
passed: function() {
|
29
|
-
return true;
|
30
|
-
}
|
31
|
-
};
|
32
|
-
}
|
33
|
-
},
|
34
|
-
failingSpec = {
|
35
|
-
results: function() {
|
36
|
-
return {
|
37
|
-
passed: function() {
|
38
|
-
return false;
|
39
|
-
}
|
40
|
-
};
|
41
|
-
}
|
42
|
-
},
|
43
|
-
skippedSpec = {
|
44
|
-
results: function() {
|
45
|
-
return {skipped: true};
|
46
|
-
}
|
47
|
-
},
|
48
|
-
passingRun = {
|
49
|
-
specs: function() {
|
50
|
-
return [null, null, null];
|
51
|
-
},
|
52
|
-
results: function() {
|
53
|
-
return {failedCount: 0, items_: [null, null, null]};
|
54
|
-
}
|
55
|
-
},
|
56
|
-
failingRun = {
|
57
|
-
specs: function() {
|
58
|
-
return [null, null, null];
|
59
|
-
},
|
60
|
-
results: function() {
|
61
|
-
return {
|
62
|
-
failedCount: 7, items_: [null, null, null]};
|
63
|
-
}
|
64
|
-
};
|
65
|
-
|
66
|
-
function repeatedlyInvoke(f, times) {
|
67
|
-
for (var i = 0; i < times; i++) f(times + 1);
|
68
|
-
}
|
69
|
-
|
70
|
-
function repeat(thing, times) {
|
71
|
-
var arr = [];
|
72
|
-
for (var i = 0; i < times; i++) arr.push(thing);
|
73
|
-
return arr;
|
74
|
-
}
|
75
|
-
|
76
|
-
function simulateRun(reporter, specResults, suiteResults, finalRunner, startTime, endTime) {
|
77
|
-
reporter.reportRunnerStarting();
|
78
|
-
for (var i = 0; i < specResults.length; i++) {
|
79
|
-
reporter.reportSpecResults(specResults[i]);
|
80
|
-
}
|
81
|
-
for (i = 0; i < suiteResults.length; i++) {
|
82
|
-
reporter.reportSuiteResults(suiteResults[i]);
|
83
|
-
}
|
84
|
-
reporter.runnerStartTime = startTime;
|
85
|
-
reporter.now = function() {
|
86
|
-
return endTime;
|
87
|
-
};
|
88
|
-
reporter.reportRunnerResults(finalRunner);
|
89
|
-
}
|
90
|
-
|
91
|
-
var reporter, out, done;
|
2
|
+
var out;
|
92
3
|
|
93
4
|
beforeEach(function() {
|
94
5
|
out = (function() {
|
95
6
|
var output = "";
|
96
7
|
return {
|
97
|
-
print:function(str) {
|
8
|
+
print: function(str) {
|
98
9
|
output += str;
|
99
10
|
},
|
100
|
-
getOutput:function() {
|
11
|
+
getOutput: function() {
|
101
12
|
return output;
|
102
13
|
},
|
103
14
|
clear: function() {
|
104
15
|
output = "";
|
105
16
|
}
|
106
17
|
};
|
107
|
-
}
|
18
|
+
}());
|
19
|
+
});
|
108
20
|
|
109
|
-
|
110
|
-
reporter = new
|
111
|
-
|
21
|
+
it("reports that the suite has started to the console", function() {
|
22
|
+
var reporter = new j$.ConsoleReporter({
|
23
|
+
print: out.print
|
112
24
|
});
|
25
|
+
|
26
|
+
reporter.jasmineStarted();
|
27
|
+
|
28
|
+
expect(out.getOutput()).toEqual("Started\n");
|
113
29
|
});
|
114
30
|
|
31
|
+
it("starts the provided timer when jasmine starts", function() {
|
32
|
+
var timerSpy = jasmine.createSpyObj('timer', ['start']),
|
33
|
+
reporter = new j$.ConsoleReporter({
|
34
|
+
print: out.print,
|
35
|
+
timer: timerSpy
|
36
|
+
});
|
115
37
|
|
116
|
-
|
117
|
-
it("prints the proper output under a pass scenario - small numbers.", function() {
|
118
|
-
simulateRun(reporter,
|
119
|
-
repeat(passingSpec, 3),
|
120
|
-
[],
|
121
|
-
{
|
122
|
-
specs: function() {
|
123
|
-
return [null, null, null];
|
124
|
-
},
|
125
|
-
results:function() {
|
126
|
-
return {
|
127
|
-
items_: [null, null, null],
|
128
|
-
totalCount: 7,
|
129
|
-
failedCount: 0
|
130
|
-
};
|
131
|
-
}
|
132
|
-
},
|
133
|
-
1000,
|
134
|
-
1777
|
135
|
-
);
|
136
|
-
|
137
|
-
var output = out.getOutput();
|
138
|
-
expect(output).toMatch(/^Started/);
|
139
|
-
expect(output).toMatch(/\.\.\./);
|
140
|
-
expect(output).toMatch(/3 specs, 0 failures/);
|
141
|
-
});
|
38
|
+
reporter.jasmineStarted();
|
142
39
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
return [null, null, null];
|
150
|
-
},
|
151
|
-
results:function() {
|
152
|
-
return {
|
153
|
-
items_: [null, null, null],
|
154
|
-
totalCount: 7,
|
155
|
-
failedCount: 0
|
156
|
-
};
|
157
|
-
}
|
158
|
-
},
|
159
|
-
1000,
|
160
|
-
1777);
|
161
|
-
|
162
|
-
var output = out.getOutput();
|
163
|
-
expect(output).toMatch(/^Started/);
|
164
|
-
expect(output).toMatch(/\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\./);
|
165
|
-
expect(output).toMatch(/3 specs, 0 failures/);
|
40
|
+
expect(timerSpy.start).toHaveBeenCalled();
|
41
|
+
});
|
42
|
+
|
43
|
+
it("reports a passing spec as a dot", function() {
|
44
|
+
var reporter = new j$.ConsoleReporter({
|
45
|
+
print: out.print
|
166
46
|
});
|
167
47
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
{failedCount:2,
|
177
|
-
description:"heats up",
|
178
|
-
items_:[
|
179
|
-
{trace:{stack:"stack trace one\n second line"}},
|
180
|
-
{trace:{stack:"stack trace two"}}
|
181
|
-
]}
|
182
|
-
]
|
183
|
-
};
|
184
|
-
}},
|
185
|
-
{description:"The washing machine",
|
186
|
-
results:function() {
|
187
|
-
return {
|
188
|
-
items_:[
|
189
|
-
{failedCount:2,
|
190
|
-
description:"washes clothes",
|
191
|
-
items_:[
|
192
|
-
{trace:{stack:"stack trace one"}}
|
193
|
-
]}
|
194
|
-
]
|
195
|
-
};
|
196
|
-
}}
|
197
|
-
],
|
198
|
-
{
|
199
|
-
specs: function() {
|
200
|
-
return [null, null, null];
|
201
|
-
},
|
202
|
-
results:function() {
|
203
|
-
return {
|
204
|
-
items_: [null, null, null],
|
205
|
-
totalCount: 7,
|
206
|
-
failedCount: 2
|
207
|
-
};
|
208
|
-
}
|
209
|
-
},
|
210
|
-
1000,
|
211
|
-
1777);
|
212
|
-
|
213
|
-
var output = out.getOutput();
|
214
|
-
expect(output).toMatch(/^Started/);
|
215
|
-
expect(output).toMatch(/F\.F/);
|
216
|
-
expect(output).toMatch(/The oven heats up\n stack trace one\n second line\n stack trace two/);
|
217
|
-
expect(output).toMatch(/The washing machine washes clothes\n stack trace one/);
|
218
|
-
expect(output).toMatch(/3 specs, 2 failures/);
|
48
|
+
reporter.specDone({status: "passed"});
|
49
|
+
|
50
|
+
expect(out.getOutput()).toEqual(".");
|
51
|
+
});
|
52
|
+
|
53
|
+
it("does not report a disabled spec", function() {
|
54
|
+
var reporter = new j$.ConsoleReporter({
|
55
|
+
print: out.print
|
219
56
|
});
|
57
|
+
|
58
|
+
reporter.specDone({status: "disabled"});
|
59
|
+
|
60
|
+
expect(out.getOutput()).toEqual("");
|
220
61
|
});
|
221
62
|
|
222
|
-
|
223
|
-
|
224
|
-
|
63
|
+
it("reports a failing spec as an 'F'", function() {
|
64
|
+
var reporter = new j$.ConsoleReporter({
|
65
|
+
print: out.print
|
225
66
|
});
|
226
67
|
|
227
|
-
|
228
|
-
|
68
|
+
reporter.specDone({status: "failed"});
|
69
|
+
|
70
|
+
expect(out.getOutput()).toEqual("F");
|
71
|
+
});
|
72
|
+
|
73
|
+
it("reports a pending spec as a '*'", function() {
|
74
|
+
var reporter = new j$.ConsoleReporter({
|
75
|
+
print: out.print
|
229
76
|
});
|
230
77
|
|
231
|
-
|
232
|
-
beforeEach(function() {
|
233
|
-
out.clear();
|
234
|
-
});
|
78
|
+
reporter.specDone({status: "pending"});
|
235
79
|
|
236
|
-
|
237
|
-
|
80
|
+
expect(out.getOutput()).toEqual("*");
|
81
|
+
});
|
238
82
|
|
239
|
-
|
240
|
-
|
83
|
+
it("reports a summary when done (singluar spec and time)", function() {
|
84
|
+
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
85
|
+
reporter = new j$.ConsoleReporter({
|
86
|
+
print: out.print,
|
87
|
+
timer: timerSpy
|
88
|
+
});
|
241
89
|
|
242
|
-
|
243
|
-
|
90
|
+
reporter.jasmineStarted();
|
91
|
+
reporter.specDone({status: "passed"});
|
244
92
|
|
245
|
-
|
246
|
-
});
|
93
|
+
timerSpy.elapsed.and.callReturn(1000);
|
247
94
|
|
248
|
-
|
249
|
-
|
95
|
+
out.clear();
|
96
|
+
reporter.jasmineDone();
|
250
97
|
|
251
|
-
|
252
|
-
|
98
|
+
expect(out.getOutput()).toMatch(/1 spec, 0 failures/);
|
99
|
+
expect(out.getOutput()).not.toMatch(/0 pending specs/);
|
100
|
+
expect(out.getOutput()).toMatch("Finished in 1 second\n");
|
101
|
+
});
|
102
|
+
|
103
|
+
it("reports a summary when done (pluralized specs and seconds)", function() {
|
104
|
+
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
|
105
|
+
reporter = new j$.ConsoleReporter({
|
106
|
+
print: out.print,
|
107
|
+
timer: timerSpy
|
108
|
+
});
|
109
|
+
|
110
|
+
reporter.jasmineStarted();
|
111
|
+
reporter.specDone({status: "passed"});
|
112
|
+
reporter.specDone({status: "pending"});
|
113
|
+
reporter.specDone({
|
114
|
+
status: "failed",
|
115
|
+
description: "with a failing spec",
|
116
|
+
fullName: "A suite with a failing spec",
|
117
|
+
failedExpectations: [
|
118
|
+
{
|
119
|
+
passed: false,
|
120
|
+
message: "Expected true to be false.",
|
121
|
+
expected: false,
|
122
|
+
actual: true,
|
123
|
+
stack: "foo\nbar\nbaz"
|
124
|
+
}
|
125
|
+
]
|
253
126
|
});
|
254
127
|
|
255
|
-
|
256
|
-
var emptyResults;
|
257
|
-
beforeEach(function() {
|
258
|
-
emptyResults = function() {
|
259
|
-
return {
|
260
|
-
items_:[]
|
261
|
-
};
|
262
|
-
};
|
263
|
-
});
|
128
|
+
out.clear();
|
264
129
|
|
265
|
-
|
266
|
-
reporter.reportSuiteResults({description: "Oven", results: emptyResults});
|
267
|
-
reporter.reportSuiteResults({description: "Mixer", results: emptyResults});
|
130
|
+
timerSpy.elapsed.and.callReturn(100);
|
268
131
|
|
269
|
-
|
270
|
-
expect(reporter.suiteResults[1].description).toEqual('Mixer');
|
271
|
-
});
|
132
|
+
reporter.jasmineDone();
|
272
133
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
results: emptyResults
|
277
|
-
};
|
278
|
-
var parentSuite = {
|
279
|
-
description: "kitchen",
|
280
|
-
parentSuite: grandparentSuite,
|
281
|
-
results: emptyResults
|
282
|
-
};
|
283
|
-
reporter.reportSuiteResults({ description: "oven", parentSuite: parentSuite, results: emptyResults });
|
284
|
-
|
285
|
-
expect(reporter.suiteResults[0].description).toEqual("My house kitchen oven");
|
286
|
-
});
|
134
|
+
expect(out.getOutput()).toMatch(/3 specs, 1 failure, 1 pending spec/);
|
135
|
+
expect(out.getOutput()).toMatch("Finished in 0.1 seconds\n");
|
136
|
+
});
|
287
137
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
items_:[
|
293
|
-
{ failedCount: 0, description: "specOne" },
|
294
|
-
{ failedCount: 99, description: "specTwo" },
|
295
|
-
{ failedCount: 0, description: "specThree" },
|
296
|
-
{ failedCount: 88, description: "specFour" },
|
297
|
-
{ failedCount: 3 }
|
298
|
-
]
|
299
|
-
};
|
300
|
-
}});
|
301
|
-
|
302
|
-
expect(reporter.suiteResults[0].failedSpecResults).
|
303
|
-
toEqual([
|
304
|
-
{ failedCount: 99, description: "specTwo" },
|
305
|
-
{ failedCount: 88, description: "specFour" }
|
306
|
-
]);
|
307
|
-
});
|
138
|
+
it("reports a summary when done that includes stack traces for a failing suite", function() {
|
139
|
+
var reporter = new j$.ConsoleReporter({
|
140
|
+
print: out.print
|
141
|
+
});
|
308
142
|
|
143
|
+
reporter.jasmineStarted();
|
144
|
+
reporter.specDone({status: "passed"});
|
145
|
+
reporter.specDone({
|
146
|
+
status: "failed",
|
147
|
+
description: "with a failing spec",
|
148
|
+
fullName: "A suite with a failing spec",
|
149
|
+
failedExpectations: [
|
150
|
+
{
|
151
|
+
passed: false,
|
152
|
+
message: "Expected true to be false.",
|
153
|
+
expected: false,
|
154
|
+
actual: true,
|
155
|
+
stack: "foo bar baz"
|
156
|
+
}
|
157
|
+
]
|
309
158
|
});
|
310
159
|
|
311
|
-
|
160
|
+
out.clear();
|
312
161
|
|
313
|
-
|
162
|
+
reporter.jasmineDone({});
|
314
163
|
|
315
|
-
|
316
|
-
|
317
|
-
{description:"The oven", failedSpecResults:[
|
318
|
-
{description:"heats up", items_:[]},
|
319
|
-
{description:"cleans itself", items_:[]}
|
320
|
-
]},
|
321
|
-
{description:"The mixer", failedSpecResults:[
|
322
|
-
{description:"blends things together", items_:[]}
|
323
|
-
]}
|
324
|
-
];
|
164
|
+
expect(out.getOutput()).toMatch(/foo bar baz/);
|
165
|
+
});
|
325
166
|
|
326
|
-
|
167
|
+
it("calls the onComplete callback when the suite is done", function() {
|
168
|
+
var onComplete = jasmine.createSpy('onComplete'),
|
169
|
+
reporter = new j$.ConsoleReporter({
|
170
|
+
print: out.print,
|
171
|
+
onComplete: onComplete
|
172
|
+
});
|
327
173
|
|
328
|
-
|
329
|
-
expect(out.getOutput()).toContain("The oven cleans itself");
|
330
|
-
expect(out.getOutput()).toContain("The mixer blends things together");
|
331
|
-
});
|
174
|
+
reporter.jasmineDone({});
|
332
175
|
|
333
|
-
|
334
|
-
|
335
|
-
{description:"The oven", failedSpecResults:[
|
336
|
-
{description:"heats up",
|
337
|
-
items_:[
|
338
|
-
{trace:{stack:"stack trace one"}},
|
339
|
-
{trace:{stack:"stack trace two"}}
|
340
|
-
]}
|
341
|
-
]}
|
342
|
-
];
|
343
|
-
|
344
|
-
reporter.reportRunnerResults(failingRun);
|
345
|
-
|
346
|
-
expect(out.getOutput()).toContain("The oven heats up");
|
347
|
-
expect(out.getOutput()).toContain("stack trace one");
|
348
|
-
expect(out.getOutput()).toContain("stack trace two");
|
349
|
-
});
|
176
|
+
expect(onComplete).toHaveBeenCalled();
|
177
|
+
});
|
350
178
|
|
351
|
-
});
|
352
179
|
|
353
|
-
|
354
|
-
|
355
|
-
it("prints the full finished message", function() {
|
356
|
-
reporter.now = function() {
|
357
|
-
return 1000;
|
358
|
-
};
|
359
|
-
reporter.reportRunnerStarting();
|
360
|
-
reporter.now = function() {
|
361
|
-
return 1777;
|
362
|
-
};
|
363
|
-
reporter.reportRunnerResults(failingRun);
|
364
|
-
expect(out.getOutput()).toContain("Finished in 0.777 seconds");
|
365
|
-
});
|
180
|
+
describe("with color", function() {
|
366
181
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
return endTime;
|
373
|
-
};
|
374
|
-
reporter.reportRunnerResults(passingRun);
|
375
|
-
}
|
182
|
+
it("reports that the suite has started to the console", function() {
|
183
|
+
var reporter = new j$.ConsoleReporter({
|
184
|
+
print: out.print,
|
185
|
+
showColors: true
|
186
|
+
});
|
376
187
|
|
377
|
-
|
378
|
-
expect(out.getOutput()).toContain("10 seconds");
|
188
|
+
reporter.jasmineStarted();
|
379
189
|
|
380
|
-
|
381
|
-
|
190
|
+
expect(out.getOutput()).toEqual("Started\n");
|
191
|
+
});
|
382
192
|
|
383
|
-
|
384
|
-
|
193
|
+
it("reports a passing spec as a dot", function() {
|
194
|
+
var reporter = new j$.ConsoleReporter({
|
195
|
+
print: out.print,
|
196
|
+
showColors: true
|
197
|
+
});
|
385
198
|
|
386
|
-
|
387
|
-
expect(out.getOutput()).toContain("0.01 seconds");
|
199
|
+
reporter.specDone({status: "passed"});
|
388
200
|
|
389
|
-
|
390
|
-
|
391
|
-
|
201
|
+
expect(out.getOutput()).toEqual("\033[32m.\033[0m");
|
202
|
+
});
|
203
|
+
|
204
|
+
it("does not report a disabled spec", function() {
|
205
|
+
var reporter = new j$.ConsoleReporter({
|
206
|
+
print: out.print,
|
207
|
+
showColors: true
|
392
208
|
});
|
393
209
|
|
394
|
-
|
395
|
-
it("prints statistics in green if there were no failures", function() {
|
396
|
-
reporter.reportRunnerResults({
|
397
|
-
specs: function() {
|
398
|
-
return [null, null, null];
|
399
|
-
},
|
400
|
-
results:function() {
|
401
|
-
return {items_: [null, null, null], totalCount: 7, failedCount: 0};
|
402
|
-
}
|
403
|
-
});
|
404
|
-
expect(out.getOutput()).
|
405
|
-
toContain("3 specs, 0 failures");
|
406
|
-
});
|
210
|
+
reporter.specDone({status: 'disabled'});
|
407
211
|
|
408
|
-
|
409
|
-
|
410
|
-
specs: function() {
|
411
|
-
return [null, null, null];
|
412
|
-
},
|
413
|
-
results:function() {
|
414
|
-
return {items_: [null, null, null], totalCount: 7, failedCount: 3};
|
415
|
-
}
|
416
|
-
});
|
417
|
-
expect(out.getOutput()).
|
418
|
-
toContain("3 specs, 3 failures");
|
419
|
-
});
|
212
|
+
expect(out.getOutput()).toEqual("");
|
213
|
+
});
|
420
214
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
},
|
426
|
-
results:function() {
|
427
|
-
return {items_: [null], totalCount: 1, failedCount: 1};
|
428
|
-
}
|
429
|
-
});
|
430
|
-
expect(out.getOutput()).
|
431
|
-
toContain("1 spec, 1 failure");
|
432
|
-
});
|
215
|
+
it("reports a failing spec as an 'F'", function() {
|
216
|
+
var reporter = new j$.ConsoleReporter({
|
217
|
+
print: out.print,
|
218
|
+
showColors: true
|
433
219
|
});
|
434
220
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
reporter.reportRunnerResults({
|
439
|
-
specs: function() {
|
440
|
-
return [null, null, null];
|
441
|
-
},
|
442
|
-
results:function() {
|
443
|
-
return {items_: [null, null, null], totalCount: 7, failedCount: 0};
|
444
|
-
}
|
445
|
-
});
|
446
|
-
expect(done).toBeTruthy();
|
447
|
-
});
|
448
|
-
});
|
221
|
+
reporter.specDone({status: 'failed'});
|
222
|
+
|
223
|
+
expect(out.getOutput()).toEqual("\033[31mF\033[0m");
|
449
224
|
});
|
450
225
|
});
|
451
|
-
});
|
226
|
+
});
|