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.
Files changed (73) hide show
  1. data/lib/jasmine-core.rb +14 -1
  2. data/lib/jasmine-core/boot.js +131 -0
  3. data/lib/jasmine-core/boot/boot.js +109 -0
  4. data/lib/jasmine-core/example/spec/PlayerSpec.js +2 -2
  5. data/lib/jasmine-core/example/spec/SpecHelper.js +14 -8
  6. data/lib/jasmine-core/jasmine-html.js +289 -616
  7. data/lib/jasmine-core/jasmine.css +52 -80
  8. data/lib/jasmine-core/jasmine.js +1972 -2211
  9. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +161 -386
  10. data/lib/jasmine-core/spec/core/AnySpec.js +45 -0
  11. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +105 -0
  12. data/lib/jasmine-core/spec/core/ClockSpec.js +314 -0
  13. data/lib/jasmine-core/spec/core/CustomMatchersSpec.js +96 -97
  14. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +179 -0
  15. data/lib/jasmine-core/spec/core/EnvSpec.js +454 -102
  16. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +56 -0
  17. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +15 -126
  18. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +61 -0
  19. data/lib/jasmine-core/spec/core/ExpectationSpec.js +320 -0
  20. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +150 -38
  21. data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +64 -0
  22. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +43 -42
  23. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +147 -0
  24. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +40 -0
  25. data/lib/jasmine-core/spec/core/SpecRunningSpec.js +92 -1075
  26. data/lib/jasmine-core/spec/core/SpecSpec.js +215 -95
  27. data/lib/jasmine-core/spec/core/SpySpec.js +28 -196
  28. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +101 -0
  29. data/lib/jasmine-core/spec/core/SuiteSpec.js +216 -106
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +13 -0
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +19 -30
  32. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +219 -0
  33. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +51 -0
  34. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +18 -0
  35. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +38 -0
  36. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +19 -0
  37. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +20 -0
  38. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +36 -0
  39. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +17 -0
  40. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +17 -0
  41. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +38 -0
  42. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +17 -0
  43. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +24 -0
  44. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +28 -0
  45. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +46 -0
  46. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +57 -0
  47. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +34 -0
  48. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +280 -0
  49. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +98 -0
  50. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +19 -0
  51. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +494 -0
  52. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +18 -0
  53. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +8 -8
  54. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +3 -3
  55. data/lib/jasmine-core/spec/html/QueryStringSpec.js +43 -0
  56. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +62 -0
  57. data/lib/jasmine-core/spec/node_suite.js +137 -79
  58. data/lib/jasmine-core/spec/performance/performance_test.js +10 -0
  59. data/lib/jasmine-core/spec/support/dev_boot.js +118 -0
  60. data/lib/jasmine-core/version.rb +5 -2
  61. metadata +47 -103
  62. data/lib/jasmine-core/example/SpecRunner.html +0 -54
  63. data/lib/jasmine-core/spec/core/BaseSpec.js +0 -27
  64. data/lib/jasmine-core/spec/core/MatchersSpec.js +0 -1157
  65. data/lib/jasmine-core/spec/core/MockClockSpec.js +0 -38
  66. data/lib/jasmine-core/spec/core/MultiReporterSpec.js +0 -45
  67. data/lib/jasmine-core/spec/core/NestedResultsSpec.js +0 -54
  68. data/lib/jasmine-core/spec/core/QueueSpec.js +0 -23
  69. data/lib/jasmine-core/spec/core/ReporterSpec.js +0 -56
  70. data/lib/jasmine-core/spec/core/RunnerSpec.js +0 -280
  71. data/lib/jasmine-core/spec/core/WaitsForBlockSpec.js +0 -118
  72. data/lib/jasmine-core/spec/html/HTMLReporterSpec.js +0 -209
  73. data/lib/jasmine-core/spec/html/TrivialReporterSpec.js +0 -239
@@ -1,451 +1,226 @@
1
1
  describe("ConsoleReporter", function() {
2
- //keep these literal. otherwise the test loses value as a test.
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
- done = false;
110
- reporter = new jasmine.ConsoleReporter(out.print, function(runner) {
111
- done = true
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
- describe('Integration', function() {
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
- it("prints the proper output under a pass scenario. large numbers.", function() {
144
- simulateRun(reporter,
145
- repeat(passingSpec, 57),
146
- [],
147
- {
148
- specs: function() {
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
- it("prints the proper output under a failure scenario.", function() {
169
- simulateRun(reporter,
170
- [failingSpec, passingSpec, failingSpec],
171
- [
172
- {description:"The oven",
173
- results:function() {
174
- return {
175
- items_:[
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
- describe('When a Jasmine environment executes', function() {
223
- beforeEach(function() {
224
- reporter.reportRunnerStarting();
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
- it("should print 'Started' to the console", function() {
228
- expect(out.getOutput()).toEqual("Started" + newline);
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
- describe('when a spec reports', function() {
232
- beforeEach(function() {
233
- out.clear();
234
- });
78
+ reporter.specDone({status: "pending"});
235
79
 
236
- it("prints a green dot if the spec passes", function() {
237
- reporter.reportSpecResults(passingSpec);
80
+ expect(out.getOutput()).toEqual("*");
81
+ });
238
82
 
239
- expect(out.getOutput()).toMatch(/\./);
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
- it("prints a red dot if the spec fails", function() {
243
- reporter.reportSpecResults(failingSpec);
90
+ reporter.jasmineStarted();
91
+ reporter.specDone({status: "passed"});
244
92
 
245
- expect(out.getOutput()).toMatch(/F/);
246
- });
93
+ timerSpy.elapsed.and.callReturn(1000);
247
94
 
248
- it("prints a yellow star if the spec was skipped", function() {
249
- reporter.reportSpecResults(skippedSpec);
95
+ out.clear();
96
+ reporter.jasmineDone();
250
97
 
251
- expect(out.getOutput()).toMatch(/\*/);
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
- describe('when a suite reports', function() {
256
- var emptyResults;
257
- beforeEach(function() {
258
- emptyResults = function() {
259
- return {
260
- items_:[]
261
- };
262
- };
263
- });
128
+ out.clear();
264
129
 
265
- it("remembers suite results", function() {
266
- reporter.reportSuiteResults({description: "Oven", results: emptyResults});
267
- reporter.reportSuiteResults({description: "Mixer", results: emptyResults});
130
+ timerSpy.elapsed.and.callReturn(100);
268
131
 
269
- expect(reporter.suiteResults[0].description).toEqual('Oven');
270
- expect(reporter.suiteResults[1].description).toEqual('Mixer');
271
- });
132
+ reporter.jasmineDone();
272
133
 
273
- it("creates a description out of the current suite and any parent suites", function() {
274
- var grandparentSuite = {
275
- description: "My house",
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
- it("gathers failing spec results from the suite - the spec must have a description.", function() {
289
- reporter.reportSuiteResults({description:"Oven",
290
- results: function() {
291
- return {
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
- describe('and finishes', function() {
160
+ out.clear();
312
161
 
313
- describe('when reporting spec failure information', function() {
162
+ reporter.jasmineDone({});
314
163
 
315
- it("prints suite and spec descriptions together as a sentence", function() {
316
- reporter.suiteResults = [
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
- reporter.reportRunnerResults(failingRun);
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
- expect(out.getOutput()).toContain("The oven heats up");
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
- it("prints stack trace of spec failure", function() {
334
- reporter.suiteResults = [
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
- describe('when reporting the execution time', function() {
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
- it("prints round time numbers correctly", function() {
368
- function run(startTime, endTime) {
369
- out.clear();
370
- reporter.runnerStartTime = startTime;
371
- reporter.now = function() {
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
- run(1000, 11000);
378
- expect(out.getOutput()).toContain("10 seconds");
188
+ reporter.jasmineStarted();
379
189
 
380
- run(1000, 2000);
381
- expect(out.getOutput()).toContain("1 seconds");
190
+ expect(out.getOutput()).toEqual("Started\n");
191
+ });
382
192
 
383
- run(1000, 1100);
384
- expect(out.getOutput()).toContain("0.1 seconds");
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
- run(1000, 1010);
387
- expect(out.getOutput()).toContain("0.01 seconds");
199
+ reporter.specDone({status: "passed"});
388
200
 
389
- run(1000, 1001);
390
- expect(out.getOutput()).toContain("0.001 seconds");
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
- describe("when reporting the results summary", function() {
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
- it("prints statistics in red if there was a failure", function() {
409
- reporter.reportRunnerResults({
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
- it("handles pluralization with 1's ones appropriately", function() {
422
- reporter.reportRunnerResults({
423
- specs: function() {
424
- return [null];
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
- describe("done callback", function() {
436
- it("calls back when done", function() {
437
- expect(done).toBeFalsy();
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
+ });