jasmine-core 2.9.0 → 2.99.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jasmine-core/jasmine-html.js +24 -1
  3. data/lib/jasmine-core/jasmine.css +1 -0
  4. data/lib/jasmine-core/jasmine.js +50 -6
  5. data/lib/jasmine-core/version.rb +1 -1
  6. metadata +3 -84
  7. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +0 -270
  8. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +0 -130
  9. data/lib/jasmine-core/spec/core/ClearStackSpec.js +0 -137
  10. data/lib/jasmine-core/spec/core/ClockSpec.js +0 -754
  11. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +0 -270
  12. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -200
  13. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +0 -63
  14. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +0 -68
  15. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +0 -61
  16. data/lib/jasmine-core/spec/core/ExpectationSpec.js +0 -434
  17. data/lib/jasmine-core/spec/core/GlobalErrorsSpec.js +0 -110
  18. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +0 -259
  19. data/lib/jasmine-core/spec/core/MockDateSpec.js +0 -200
  20. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +0 -337
  21. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +0 -620
  22. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +0 -79
  23. data/lib/jasmine-core/spec/core/SpecSpec.js +0 -441
  24. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +0 -356
  25. data/lib/jasmine-core/spec/core/SpySpec.js +0 -127
  26. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +0 -159
  27. data/lib/jasmine-core/spec/core/SuiteSpec.js +0 -155
  28. data/lib/jasmine-core/spec/core/TimerSpec.js +0 -31
  29. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +0 -756
  30. data/lib/jasmine-core/spec/core/UserContextSpec.js +0 -54
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +0 -99
  32. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +0 -84
  33. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +0 -76
  34. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +0 -52
  35. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayWithExactContentsSpec.js +0 -47
  36. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +0 -102
  37. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +0 -27
  38. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +0 -13
  39. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +0 -199
  40. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +0 -2007
  41. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +0 -950
  42. data/lib/jasmine-core/spec/core/matchers/DiffBuilderSpec.js +0 -47
  43. data/lib/jasmine-core/spec/core/matchers/NullDiffBuilderSpec.js +0 -13
  44. data/lib/jasmine-core/spec/core/matchers/ObjectPathSpec.js +0 -43
  45. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +0 -658
  46. data/lib/jasmine-core/spec/core/matchers/nothingSpec.js +0 -8
  47. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +0 -93
  48. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +0 -18
  49. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +0 -38
  50. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +0 -29
  51. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  52. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +0 -29
  53. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +0 -20
  54. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +0 -37
  55. data/lib/jasmine-core/spec/core/matchers/toBeNegativeInfinitySpec.js +0 -31
  56. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +0 -17
  57. data/lib/jasmine-core/spec/core/matchers/toBePositiveInfinitySpec.js +0 -31
  58. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +0 -17
  59. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +0 -38
  60. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  61. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +0 -26
  62. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +0 -804
  63. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledBeforeSpec.js +0 -99
  64. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  65. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +0 -86
  66. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -67
  67. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +0 -43
  68. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +0 -315
  69. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +0 -100
  70. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +0 -27
  71. data/lib/jasmine-core/spec/helpers/asyncAwait.js +0 -27
  72. data/lib/jasmine-core/spec/helpers/checkForMap.js +0 -37
  73. data/lib/jasmine-core/spec/helpers/checkForSet.js +0 -41
  74. data/lib/jasmine-core/spec/helpers/checkForSymbol.js +0 -28
  75. data/lib/jasmine-core/spec/helpers/checkForTypedArrays.js +0 -20
  76. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +0 -7
  77. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
  78. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +0 -982
  79. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +0 -18
  80. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +0 -37
  81. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +0 -15
  82. data/lib/jasmine-core/spec/html/QueryStringSpec.js +0 -72
  83. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +0 -62
  84. data/lib/jasmine-core/spec/html/SpyRegistryHtmlSpec.js +0 -34
  85. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +0 -101
  86. data/lib/jasmine-core/spec/performance/large_object_test.js +0 -36
  87. data/lib/jasmine-core/spec/performance/performance_test.js +0 -10
@@ -1,950 +0,0 @@
1
- describe("jasmine spec running", function () {
2
- var env;
3
-
4
- beforeEach(function() {
5
- env = new jasmineUnderTest.Env();
6
- });
7
-
8
- it('should assign spec ids sequentially', function() {
9
- var it0, it1, it2, it3, it4;
10
- env.describe('test suite', function() {
11
- it0 = env.it('spec 0', function() {
12
- });
13
- it1 = env.it('spec 1', function() {
14
- });
15
- it2 = env.xit('spec 2', function() {
16
- });
17
- it3 = env.it('spec 3', function() {
18
- });
19
- });
20
- env.describe('test suite 2', function() {
21
- it4 = env.it('spec 4', function() {
22
- });
23
- });
24
-
25
- expect(it0.id).toEqual('spec0');
26
- expect(it1.id).toEqual('spec1');
27
- expect(it2.id).toEqual('spec2');
28
- expect(it3.id).toEqual('spec3');
29
- expect(it4.id).toEqual('spec4');
30
- });
31
-
32
- it('nested suites', function (done) {
33
-
34
- var foo = 0;
35
- var bar = 0;
36
- var baz = 0;
37
- var quux = 0;
38
- var nested = env.describe('suite', function () {
39
- env.describe('nested', function () {
40
- env.it('should run nested suites', function () {
41
- foo++;
42
- });
43
- env.it('should run nested suites', function () {
44
- bar++;
45
- });
46
- });
47
-
48
- env.describe('nested 2', function () {
49
- env.it('should run suites following nested suites', function () {
50
- baz++;
51
- });
52
- });
53
-
54
- env.it('should run tests following nested suites', function () {
55
- quux++;
56
- });
57
- });
58
-
59
- expect(foo).toEqual(0);
60
- expect(bar).toEqual(0);
61
- expect(baz).toEqual(0);
62
- expect(quux).toEqual(0);
63
- var assertions = function() {
64
- expect(foo).toEqual(1);
65
- expect(bar).toEqual(1);
66
- expect(baz).toEqual(1);
67
- expect(quux).toEqual(1);
68
- done();
69
- };
70
-
71
- env.addReporter({ jasmineDone: assertions });
72
-
73
- env.execute();
74
- });
75
-
76
- it("should permit nested describes", function(done) {
77
- var actions = [];
78
-
79
- env.beforeEach(function () {
80
- actions.push('topSuite beforeEach');
81
- });
82
-
83
- env.afterEach(function () {
84
- actions.push('topSuite afterEach');
85
- });
86
-
87
- env.describe('Something', function() {
88
- env.beforeEach(function() {
89
- actions.push('outer beforeEach');
90
- });
91
-
92
- env.afterEach(function() {
93
- actions.push('outer afterEach');
94
- });
95
-
96
- env.it('does it 1', function() {
97
- actions.push('outer it 1');
98
- });
99
-
100
- env.describe('Inner 1', function() {
101
- env.beforeEach(function() {
102
- actions.push('inner 1 beforeEach');
103
- });
104
-
105
- env.afterEach(function() {
106
- actions.push('inner 1 afterEach');
107
- });
108
-
109
- env.it('does it 2', function() {
110
- actions.push('inner 1 it');
111
- });
112
- });
113
-
114
- env.it('does it 3', function() {
115
- actions.push('outer it 2');
116
- });
117
-
118
- env.describe('Inner 2', function() {
119
- env.beforeEach(function() {
120
- actions.push('inner 2 beforeEach');
121
- });
122
-
123
- env.afterEach(function() {
124
- actions.push('inner 2 afterEach');
125
- });
126
-
127
- env.it('does it 2', function() {
128
- actions.push('inner 2 it');
129
- });
130
- });
131
- });
132
-
133
- var assertions = function() {
134
- var expected = [
135
- "topSuite beforeEach",
136
- "outer beforeEach",
137
- "outer it 1",
138
- "outer afterEach",
139
- "topSuite afterEach",
140
-
141
- "topSuite beforeEach",
142
- "outer beforeEach",
143
- "inner 1 beforeEach",
144
- "inner 1 it",
145
- "inner 1 afterEach",
146
- "outer afterEach",
147
- "topSuite afterEach",
148
-
149
- "topSuite beforeEach",
150
- "outer beforeEach",
151
- "outer it 2",
152
- "outer afterEach",
153
- "topSuite afterEach",
154
-
155
- "topSuite beforeEach",
156
- "outer beforeEach",
157
- "inner 2 beforeEach",
158
- "inner 2 it",
159
- "inner 2 afterEach",
160
- "outer afterEach",
161
- "topSuite afterEach"
162
- ];
163
- expect(actions).toEqual(expected);
164
- done();
165
- };
166
-
167
- env.addReporter({jasmineDone: assertions});
168
-
169
- env.execute();
170
- });
171
-
172
- it("should run multiple befores and afters ordered so functions declared later are treated as more specific", function(done) {
173
- var actions = [];
174
-
175
- env.beforeAll(function() {
176
- actions.push('runner beforeAll1');
177
- });
178
-
179
- env.afterAll(function() {
180
- actions.push('runner afterAll1');
181
- });
182
-
183
- env.beforeAll(function() {
184
- actions.push('runner beforeAll2');
185
- });
186
-
187
- env.afterAll(function() {
188
- actions.push('runner afterAll2');
189
- });
190
-
191
- env.beforeEach(function () {
192
- actions.push('runner beforeEach1');
193
- });
194
-
195
- env.afterEach(function () {
196
- actions.push('runner afterEach1');
197
- });
198
-
199
- env.beforeEach(function () {
200
- actions.push('runner beforeEach2');
201
- });
202
-
203
- env.afterEach(function () {
204
- actions.push('runner afterEach2');
205
- });
206
-
207
- env.describe('Something', function() {
208
- env.beforeEach(function() {
209
- actions.push('beforeEach1');
210
- });
211
-
212
- env.afterEach(function() {
213
- actions.push('afterEach1');
214
- });
215
-
216
- env.beforeEach(function() {
217
- actions.push('beforeEach2');
218
- });
219
-
220
- env.afterEach(function() {
221
- actions.push('afterEach2');
222
- });
223
-
224
- env.it('does it 1', function() {
225
- actions.push('outer it 1');
226
- });
227
- });
228
-
229
- var assertions = function() {
230
- var expected = [
231
- "runner beforeAll1",
232
- "runner beforeAll2",
233
- "runner beforeEach1",
234
- "runner beforeEach2",
235
- "beforeEach1",
236
- "beforeEach2",
237
- "outer it 1",
238
- "afterEach2",
239
- "afterEach1",
240
- "runner afterEach2",
241
- "runner afterEach1",
242
- "runner afterAll2",
243
- "runner afterAll1"
244
- ];
245
- expect(actions).toEqual(expected);
246
- done();
247
- };
248
-
249
- env.addReporter({jasmineDone: assertions});
250
-
251
- env.execute();
252
- });
253
-
254
- it('should run beforeAlls before beforeEachs and afterAlls after afterEachs', function(done) {
255
- var actions = [];
256
-
257
- env.beforeAll(function() {
258
- actions.push('runner beforeAll');
259
- });
260
-
261
- env.afterAll(function() {
262
- actions.push('runner afterAll');
263
- });
264
-
265
- env.beforeEach(function () {
266
- actions.push('runner beforeEach');
267
- });
268
-
269
- env.afterEach(function () {
270
- actions.push('runner afterEach');
271
- });
272
-
273
- env.describe('Something', function() {
274
- env.beforeEach(function() {
275
- actions.push('inner beforeEach');
276
- });
277
-
278
- env.afterEach(function() {
279
- actions.push('inner afterEach');
280
- });
281
-
282
- env.beforeAll(function() {
283
- actions.push('inner beforeAll');
284
- });
285
-
286
- env.afterAll(function() {
287
- actions.push('inner afterAll');
288
- });
289
-
290
- env.it('does something or other', function() {
291
- actions.push('it');
292
- });
293
- });
294
-
295
- var assertions = function() {
296
- var expected = [
297
- "runner beforeAll",
298
- "inner beforeAll",
299
- "runner beforeEach",
300
- "inner beforeEach",
301
- "it",
302
- "inner afterEach",
303
- "runner afterEach",
304
- "inner afterAll",
305
- "runner afterAll"
306
- ];
307
- expect(actions).toEqual(expected);
308
- done();
309
- };
310
-
311
- env.addReporter({jasmineDone: assertions});
312
- env.execute();
313
- });
314
-
315
- it('should run beforeAlls and afterAlls in the order declared when runnablesToRun is provided', function(done) {
316
- var actions = [],
317
- spec,
318
- spec2;
319
-
320
- env.beforeAll(function() {
321
- actions.push('runner beforeAll');
322
- });
323
-
324
- env.afterAll(function() {
325
- actions.push('runner afterAll');
326
- });
327
-
328
- env.beforeEach(function () {
329
- actions.push('runner beforeEach');
330
- });
331
-
332
- env.afterEach(function () {
333
- actions.push('runner afterEach');
334
- });
335
-
336
- env.describe('Something', function() {
337
- env.beforeEach(function() {
338
- actions.push('inner beforeEach');
339
- });
340
-
341
- env.afterEach(function() {
342
- actions.push('inner afterEach');
343
- });
344
-
345
- env.beforeAll(function() {
346
- actions.push('inner beforeAll');
347
- });
348
-
349
- env.afterAll(function() {
350
- actions.push('inner afterAll');
351
- });
352
-
353
- spec = env.it('does something', function() {
354
- actions.push('it');
355
- });
356
-
357
- spec2 = env.it('does something or other', function() {
358
- actions.push('it2');
359
- });
360
- });
361
-
362
- var assertions = function() {
363
- var expected = [
364
- "runner beforeAll",
365
- "inner beforeAll",
366
- "runner beforeEach",
367
- "inner beforeEach",
368
- "it2",
369
- "inner afterEach",
370
- "runner afterEach",
371
-
372
- "runner beforeEach",
373
- "inner beforeEach",
374
- "it",
375
- "inner afterEach",
376
- "runner afterEach",
377
- "inner afterAll",
378
- "runner afterAll"
379
- ];
380
- expect(actions).toEqual(expected);
381
- done();
382
- };
383
-
384
- env.addReporter({jasmineDone: assertions});
385
- env.execute([spec2.id, spec.id]);
386
- });
387
-
388
- it('only runs *Alls once in a focused suite', function(done){
389
- var actions = [];
390
-
391
- env.fdescribe('Suite', function() {
392
- env.beforeAll(function(){
393
- actions.push('beforeAll');
394
- });
395
- env.it('should run beforeAll once', function() {
396
- actions.push('spec');
397
- });
398
- env.afterAll(function(){
399
- actions.push('afterAll');
400
- });
401
- });
402
-
403
- var assertions = function() {
404
- expect(actions).toEqual(['beforeAll', 'spec', 'afterAll']);
405
- done();
406
- };
407
-
408
- env.addReporter({jasmineDone: assertions});
409
- env.execute();
410
- });
411
-
412
- describe('focused runnables', function() {
413
- it('runs the relevant alls and eachs for each runnable', function(done) {
414
- var actions = [];
415
- env.beforeAll(function() {actions.push('beforeAll')});
416
- env.afterAll(function() {actions.push('afterAll')});
417
- env.beforeEach(function() {actions.push('beforeEach')});
418
- env.afterEach(function() {actions.push('afterEach')});
419
-
420
- env.fdescribe('a focused suite', function() {
421
- env.it('is run', function() {
422
- actions.push('spec in fdescribe')
423
- });
424
- });
425
-
426
- env.describe('an unfocused suite', function() {
427
- env.fit('has a focused spec', function() {
428
- actions.push('focused spec')
429
- });
430
- });
431
-
432
- var assertions = function() {
433
- var expected = [
434
- 'beforeAll',
435
- 'beforeEach',
436
- 'spec in fdescribe',
437
- 'afterEach',
438
-
439
- 'beforeEach',
440
- 'focused spec',
441
- 'afterEach',
442
- 'afterAll'
443
- ];
444
- expect(actions).toEqual(expected);
445
- done();
446
- };
447
-
448
- env.addReporter({jasmineDone: assertions});
449
- env.execute();
450
- });
451
-
452
- it('focused specs in focused suites cause non-focused siblings to not run', function(done){
453
- var actions = [];
454
-
455
- env.fdescribe('focused suite', function() {
456
- env.it('unfocused spec', function() {
457
- actions.push('unfocused spec')
458
- });
459
- env.fit('focused spec', function() {
460
- actions.push('focused spec')
461
- });
462
- });
463
-
464
- var assertions = function() {
465
- var expected = ['focused spec'];
466
- expect(actions).toEqual(expected);
467
- done();
468
- };
469
-
470
- env.addReporter({jasmineDone: assertions});
471
- env.execute();
472
- });
473
-
474
- it('focused suites in focused suites cause non-focused siblings to not run', function(done){
475
- var actions = [];
476
-
477
- env.fdescribe('focused suite', function() {
478
- env.it('unfocused spec', function() {
479
- actions.push('unfocused spec')
480
- });
481
- env.fdescribe('inner focused suite', function() {
482
- env.it('inner spec', function() {
483
- actions.push('inner spec');
484
- });
485
- });
486
- });
487
-
488
- var assertions = function() {
489
- var expected = ['inner spec'];
490
- expect(actions).toEqual(expected);
491
- done();
492
- };
493
-
494
- env.addReporter({jasmineDone: assertions});
495
- env.execute();
496
- });
497
-
498
- it('focused runnables unfocus ancestor focused suites', function(done) {
499
- var actions = [];
500
-
501
- env.fdescribe('focused suite', function() {
502
- env.it('unfocused spec', function() {
503
- actions.push('unfocused spec')
504
- });
505
- env.describe('inner focused suite', function() {
506
- env.fit('focused spec', function() {
507
- actions.push('focused spec');
508
- });
509
- });
510
- });
511
-
512
- var assertions = function() {
513
- var expected = ['focused spec'];
514
- expect(actions).toEqual(expected);
515
- done();
516
- };
517
-
518
- env.addReporter({jasmineDone: assertions});
519
- env.execute();
520
- });
521
- });
522
-
523
- it("shouldn't run disabled suites", function(done) {
524
- var specInADisabledSuite = jasmine.createSpy("specInADisabledSuite"),
525
- suite = env.describe('A Suite', function() {
526
- env.xdescribe('with a disabled suite', function(){
527
- env.it('spec inside a disabled suite', specInADisabledSuite);
528
- });
529
- });
530
-
531
- var assertions = function() {
532
- expect(specInADisabledSuite).not.toHaveBeenCalled();
533
- done();
534
- };
535
-
536
- env.addReporter({jasmineDone: assertions});
537
-
538
- env.execute();
539
- });
540
-
541
- it("shouldn't run before/after functions in disabled suites", function(done) {
542
- var shouldNotRun = jasmine.createSpy("shouldNotRun"),
543
- suite = env.xdescribe('A disabled Suite', function() {
544
- // None of the before/after functions should run.
545
- env.beforeAll(shouldNotRun);
546
- env.beforeEach(shouldNotRun);
547
- env.afterEach(shouldNotRun);
548
- env.afterAll(shouldNotRun);
549
-
550
- env.it('spec inside a disabled suite', shouldNotRun);
551
- });
552
-
553
- var assertions = function() {
554
- expect(shouldNotRun).not.toHaveBeenCalled();
555
- done();
556
- };
557
-
558
- env.addReporter({jasmineDone: assertions});
559
-
560
- env.execute();
561
- });
562
-
563
- it("should allow top level suites to be disabled", function(done) {
564
- var specInADisabledSuite = jasmine.createSpy("specInADisabledSuite"),
565
- otherSpec = jasmine.createSpy("otherSpec");
566
-
567
- env.xdescribe('A disabled suite', function() {
568
- env.it('spec inside a disabled suite', specInADisabledSuite);
569
- });
570
- env.describe('Another suite', function() {
571
- env.it('another spec', otherSpec);
572
- });
573
-
574
- var assertions = function() {
575
- expect(specInADisabledSuite).not.toHaveBeenCalled();
576
- expect(otherSpec).toHaveBeenCalled();
577
- done();
578
- };
579
-
580
- env.addReporter({jasmineDone: assertions});
581
-
582
- env.execute();
583
- });
584
-
585
- it("should set all pending specs to pending when a suite is run", function(done) {
586
- var pendingSpec,
587
- suite = env.describe('default current suite', function() {
588
- pendingSpec = env.it("I am a pending spec");
589
- });
590
-
591
- var assertions = function() {
592
- expect(pendingSpec.status()).toBe("pending");
593
- done();
594
- };
595
-
596
- env.addReporter({jasmineDone: assertions});
597
-
598
- env.execute();
599
- });
600
-
601
- it("should recover gracefully when there are errors in describe functions", function(done) {
602
- var specs = [],
603
- reporter = jasmine.createSpyObj(['specDone', 'jasmineDone']);
604
-
605
- reporter.specDone.and.callFake(function(result) {
606
- specs.push(result.fullName);
607
- });
608
-
609
- reporter.jasmineDone.and.callFake(function() {
610
- expect(specs).toContain('outer1 inner1 should thingy');
611
- expect(specs).toContain('outer1 inner1 encountered a declaration exception');
612
- expect(specs).toContain('outer1 inner2 should other thingy');
613
- expect(specs).toContain('outer1 encountered a declaration exception');
614
- expect(specs).toContain('outer2 should xxx');
615
- done();
616
- });
617
-
618
- expect(function() {
619
- env.describe("outer1", function() {
620
- env.describe("inner1", function() {
621
- env.it("should thingy", function() {
622
- this.expect(true).toEqual(true);
623
- });
624
-
625
- throw new Error("fake error");
626
- });
627
-
628
- env.describe("inner2", function() {
629
- env.it("should other thingy", function() {
630
- this.expect(true).toEqual(true);
631
- });
632
- });
633
-
634
- throw new Error("fake error");
635
-
636
- });
637
- }).not.toThrow();
638
-
639
- env.describe("outer2", function() {
640
- env.it("should xxx", function() {
641
- this.expect(true).toEqual(true);
642
- });
643
- });
644
-
645
- env.addReporter(reporter);
646
- env.execute();
647
- });
648
-
649
- it("re-enters suites that have no *Alls", function(done) {
650
- var actions = [],
651
- spec1, spec2, spec3;
652
-
653
- env.describe("top", function() {
654
- spec1 = env.it("spec1", function() {
655
- actions.push("spec1");
656
- });
657
-
658
- spec2 = env.it("spec2", function() {
659
- actions.push("spec2");
660
- });
661
- });
662
-
663
- spec3 = env.it("spec3", function() {
664
- actions.push("spec3");
665
- });
666
-
667
- env.addReporter({
668
- jasmineDone: function() {
669
- expect(actions).toEqual(["spec2", "spec3", "spec1"]);
670
- done();
671
- }
672
- });
673
-
674
- env.execute([spec2.id, spec3.id, spec1.id]);
675
- });
676
-
677
- it("refuses to re-enter suites with a beforeAll", function() {
678
- var actions = [],
679
- spec1, spec2, spec3;
680
-
681
- env.describe("top", function() {
682
- env.beforeAll(function() {});
683
-
684
- spec1 = env.it("spec1", function() {
685
- actions.push("spec1");
686
- });
687
-
688
- spec2 = env.it("spec2", function() {
689
- actions.push("spec2");
690
- });
691
- });
692
-
693
- spec3 = env.it("spec3", function() {
694
- actions.push("spec3");
695
- });
696
-
697
- env.addReporter({
698
- jasmineDone: function() {
699
- expect(actions).toEqual([]);
700
- done();
701
- }
702
- });
703
-
704
- expect(function() {
705
- env.execute([spec2.id, spec3.id, spec1.id]);
706
- }).toThrowError(/beforeAll/);
707
- });
708
-
709
- it("refuses to re-enter suites with a afterAll", function() {
710
- var actions = [],
711
- spec1, spec2, spec3;
712
-
713
- env.describe("top", function() {
714
- env.afterAll(function() {});
715
-
716
- spec1 = env.it("spec1", function() {
717
- actions.push("spec1");
718
- });
719
-
720
- spec2 = env.it("spec2", function() {
721
- actions.push("spec2");
722
- });
723
- });
724
-
725
- spec3 = env.it("spec3", function() {
726
- actions.push("spec3");
727
- });
728
-
729
- env.addReporter({
730
- jasmineDone: function() {
731
- expect(actions).toEqual([]);
732
- done();
733
- }
734
- });
735
-
736
- expect(function() {
737
- env.execute([spec2.id, spec3.id, spec1.id]);
738
- }).toThrowError(/afterAll/);
739
- });
740
-
741
- it("should run the tests in a consistent order when a seed is supplied", function(done) {
742
- var actions = [];
743
- env.randomizeTests(true);
744
- env.seed('123456');
745
-
746
- env.beforeEach(function () {
747
- actions.push('topSuite beforeEach');
748
- });
749
-
750
- env.afterEach(function () {
751
- actions.push('topSuite afterEach');
752
- });
753
-
754
- env.describe('Something', function() {
755
- env.beforeEach(function() {
756
- actions.push('outer beforeEach');
757
- });
758
-
759
- env.afterEach(function() {
760
- actions.push('outer afterEach');
761
- });
762
-
763
- env.it('does it 1', function() {
764
- actions.push('outer it 1');
765
- });
766
-
767
- env.describe('Inner 1', function() {
768
- env.beforeEach(function() {
769
- actions.push('inner 1 beforeEach');
770
- });
771
-
772
- env.afterEach(function() {
773
- actions.push('inner 1 afterEach');
774
- });
775
-
776
- env.it('does it 2', function() {
777
- actions.push('inner 1 it');
778
- });
779
- });
780
-
781
- env.it('does it 3', function() {
782
- actions.push('outer it 2');
783
- });
784
-
785
- env.describe('Inner 2', function() {
786
- env.beforeEach(function() {
787
- actions.push('inner 2 beforeEach');
788
- });
789
-
790
- env.afterEach(function() {
791
- actions.push('inner 2 afterEach');
792
- });
793
-
794
- env.it('does it 2', function() {
795
- actions.push('inner 2 it');
796
- });
797
- });
798
- });
799
-
800
- var assertions = function() {
801
- var expected = [
802
- 'topSuite beforeEach',
803
- 'outer beforeEach',
804
- 'outer it 2',
805
- 'outer afterEach',
806
- 'topSuite afterEach',
807
-
808
- 'topSuite beforeEach',
809
- 'outer beforeEach',
810
- 'inner 2 beforeEach',
811
- 'inner 2 it',
812
- 'inner 2 afterEach',
813
- 'outer afterEach',
814
- 'topSuite afterEach',
815
-
816
- 'topSuite beforeEach',
817
- 'outer beforeEach',
818
- 'inner 1 beforeEach',
819
- 'inner 1 it',
820
- 'inner 1 afterEach',
821
- 'outer afterEach',
822
- 'topSuite afterEach',
823
-
824
- 'topSuite beforeEach',
825
- 'outer beforeEach',
826
- 'outer it 1',
827
- 'outer afterEach',
828
- 'topSuite afterEach'
829
- ];
830
- expect(actions).toEqual(expected);
831
- done();
832
- };
833
-
834
- env.addReporter({jasmineDone: assertions});
835
-
836
- env.execute();
837
- });
838
-
839
- describe("When throwOnExpectationFailure is set", function() {
840
- it("skips to cleanup functions after an error", function(done) {
841
- var actions = [];
842
-
843
- env.describe('Something', function() {
844
- env.beforeEach(function() {
845
- actions.push('outer beforeEach');
846
- throw new Error("error");
847
- });
848
-
849
- env.afterEach(function() {
850
- actions.push('outer afterEach');
851
- });
852
-
853
- env.describe('Inner', function() {
854
- env.beforeEach(function() {
855
- actions.push('inner beforeEach');
856
- });
857
-
858
- env.afterEach(function() {
859
- actions.push('inner afterEach');
860
- });
861
-
862
- env.it('does it' , function() {
863
- actions.push('inner it');
864
- });
865
- });
866
- });
867
-
868
- env.throwOnExpectationFailure(true);
869
-
870
- var assertions = function() {
871
- expect(actions).toEqual([
872
- 'outer beforeEach',
873
- 'inner afterEach',
874
- 'outer afterEach'
875
- ]);
876
- done();
877
- };
878
-
879
- env.addReporter({jasmineDone: assertions});
880
-
881
- env.execute();
882
- });
883
-
884
- it("skips to cleanup functions after done.fail is called", function(done) {
885
- var actions = [];
886
-
887
- env.describe('Something', function() {
888
- env.beforeEach(function(done) {
889
- actions.push('beforeEach');
890
- done.fail('error');
891
- actions.push('after done.fail');
892
- });
893
-
894
- env.afterEach(function() {
895
- actions.push('afterEach');
896
- });
897
-
898
- env.it('does it' , function() {
899
- actions.push('it');
900
- });
901
- });
902
-
903
- env.throwOnExpectationFailure(true);
904
-
905
- var assertions = function() {
906
- expect(actions).toEqual([
907
- 'beforeEach',
908
- 'afterEach'
909
- ]);
910
- done();
911
- };
912
-
913
- env.addReporter({jasmineDone: assertions});
914
-
915
- env.execute();
916
- });
917
-
918
- it("skips to cleanup functions when an async function times out", function(done) {
919
- var actions = [];
920
-
921
- env.describe('Something', function() {
922
- env.beforeEach(function(innerDone) {
923
- actions.push('beforeEach');
924
- }, 1);
925
-
926
- env.afterEach(function() {
927
- actions.push('afterEach');
928
- });
929
-
930
- env.it('does it' , function() {
931
- actions.push('it');
932
- });
933
- });
934
-
935
- env.throwOnExpectationFailure(true);
936
-
937
- var assertions = function() {
938
- expect(actions).toEqual([
939
- 'beforeEach',
940
- 'afterEach'
941
- ]);
942
- done();
943
- };
944
-
945
- env.addReporter({jasmineDone: assertions});
946
-
947
- env.execute();
948
- });
949
- });
950
- });