jasmine-core 2.0.0 → 2.1.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/console/console.js +54 -24
  3. data/lib/jasmine-core/__init__.py +1 -0
  4. data/lib/jasmine-core/boot/boot.js +2 -63
  5. data/lib/jasmine-core/boot/node_boot.js +19 -0
  6. data/lib/jasmine-core/boot.js +3 -64
  7. data/lib/jasmine-core/core.py +60 -0
  8. data/lib/jasmine-core/example/node_example/spec/PlayerSpec.js +60 -0
  9. data/lib/jasmine-core/example/node_example/spec/SpecHelper.js +15 -0
  10. data/lib/jasmine-core/example/node_example/src/Player.js +24 -0
  11. data/lib/jasmine-core/example/node_example/src/Song.js +9 -0
  12. data/lib/jasmine-core/jasmine-html.js +119 -74
  13. data/lib/jasmine-core/jasmine.css +61 -54
  14. data/lib/jasmine-core/jasmine.js +961 -456
  15. data/lib/jasmine-core/json2.js +73 -62
  16. data/lib/jasmine-core/node_boot.js +41 -0
  17. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +52 -8
  18. data/lib/jasmine-core/spec/core/AnySpec.js +1 -0
  19. data/lib/jasmine-core/spec/core/ClockSpec.js +122 -18
  20. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +14 -1
  21. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -63
  22. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +7 -0
  23. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +2 -2
  24. data/lib/jasmine-core/spec/core/ExpectationSpec.js +46 -50
  25. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +37 -0
  26. data/lib/jasmine-core/spec/core/MockDateSpec.js +200 -0
  27. data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +6 -0
  28. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +49 -12
  29. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +184 -60
  30. data/lib/jasmine-core/spec/core/SpecSpec.js +46 -108
  31. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +55 -0
  32. data/lib/jasmine-core/spec/core/SpySpec.js +10 -0
  33. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +13 -0
  34. data/lib/jasmine-core/spec/core/SuiteSpec.js +143 -11
  35. data/lib/jasmine-core/spec/core/TimerSpec.js +18 -0
  36. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +34 -32
  37. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +969 -36
  38. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +279 -3
  39. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +18 -1
  40. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +2 -1
  41. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +3 -2
  42. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +2 -1
  43. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +4 -2
  44. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +2 -1
  45. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +17 -3
  46. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +14 -14
  47. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +5 -5
  48. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +7 -0
  49. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +33 -0
  50. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +183 -35
  51. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +1 -1
  52. data/lib/jasmine-core/spec/node_suite.js +9 -1
  53. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +104 -0
  54. data/lib/jasmine-core/spec/performance/large_object_test.js +36 -0
  55. data/lib/jasmine-core/version.rb +1 -1
  56. data/lib/jasmine-core.js +37 -0
  57. data/lib/jasmine-core.rb +6 -2
  58. metadata +23 -9
  59. data/lib/jasmine-core/spec/support/dev_boot.js +0 -124
@@ -159,7 +159,7 @@ describe("jasmine spec running", function () {
159
159
  ];
160
160
  expect(actions).toEqual(expected);
161
161
  done();
162
- }
162
+ };
163
163
 
164
164
  env.addReporter({jasmineDone: assertions});
165
165
 
@@ -228,6 +228,257 @@ describe("jasmine spec running", function () {
228
228
  env.execute();
229
229
  });
230
230
 
231
+ it('should run beforeAlls before beforeEachs and afterAlls after afterEachs', function() {
232
+ var actions = [];
233
+
234
+ env.beforeAll(function() {
235
+ actions.push('runner beforeAll');
236
+ });
237
+
238
+ env.afterAll(function() {
239
+ actions.push('runner afterAll');
240
+ });
241
+
242
+ env.beforeEach(function () {
243
+ actions.push('runner beforeEach');
244
+ });
245
+
246
+ env.afterEach(function () {
247
+ actions.push('runner afterEach');
248
+ });
249
+
250
+ env.describe('Something', function() {
251
+ env.beforeEach(function() {
252
+ actions.push('inner beforeEach');
253
+ });
254
+
255
+ env.afterEach(function() {
256
+ actions.push('inner afterEach');
257
+ });
258
+
259
+ env.beforeAll(function() {
260
+ actions.push('inner beforeAll');
261
+ });
262
+
263
+ env.afterAll(function() {
264
+ actions.push('inner afterAll');
265
+ });
266
+
267
+ env.it('does something or other', function() {
268
+ actions.push('it');
269
+ });
270
+ });
271
+
272
+ var assertions = function() {
273
+ var expected = [
274
+ "runner beforeAll",
275
+ "inner beforeAll",
276
+ "runner beforeEach",
277
+ "inner beforeEach",
278
+ "it",
279
+ "inner afterEach",
280
+ "runner afterEach",
281
+ "inner afterAll",
282
+ "runner afterAll"
283
+ ];
284
+ expect(actions).toEqual(expected);
285
+ done();
286
+ };
287
+
288
+ env.addReporter({jasmineDone: assertions});
289
+ env.execute();
290
+ });
291
+
292
+ it('should run beforeAlls and afterAlls as beforeEachs and afterEachs in the order declared when runnablesToRun is provided', function() {
293
+ var actions = [],
294
+ spec,
295
+ spec2;
296
+
297
+ env.beforeAll(function() {
298
+ actions.push('runner beforeAll');
299
+ });
300
+
301
+ env.afterAll(function() {
302
+ actions.push('runner afterAll');
303
+ });
304
+
305
+ env.beforeEach(function () {
306
+ actions.push('runner beforeEach');
307
+ });
308
+
309
+ env.afterEach(function () {
310
+ actions.push('runner afterEach');
311
+ });
312
+
313
+ env.describe('Something', function() {
314
+ env.beforeEach(function() {
315
+ actions.push('inner beforeEach');
316
+ });
317
+
318
+ env.afterEach(function() {
319
+ actions.push('inner afterEach');
320
+ });
321
+
322
+ env.beforeAll(function() {
323
+ actions.push('inner beforeAll');
324
+ });
325
+
326
+ env.afterAll(function() {
327
+ actions.push('inner afterAll');
328
+ });
329
+
330
+ spec = env.it('does something', function() {
331
+ actions.push('it');
332
+ });
333
+
334
+ spec2 = env.it('does something or other', function() {
335
+ actions.push('it2');
336
+ });
337
+ });
338
+
339
+ var assertions = function() {
340
+ var expected = [
341
+ "runner beforeAll",
342
+ "inner beforeAll",
343
+ "runner beforeEach",
344
+ "inner beforeEach",
345
+ "it",
346
+ "inner afterEach",
347
+ "runner afterEach",
348
+ "inner afterAll",
349
+ "runner afterAll",
350
+
351
+ "runner beforeAll",
352
+ "inner beforeAll",
353
+ "runner beforeEach",
354
+ "inner beforeEach",
355
+ "it2",
356
+ "inner afterEach",
357
+ "runner afterEach",
358
+ "inner afterAll",
359
+ "runner afterAll"
360
+ ];
361
+ expect(actions).toEqual(expected);
362
+ done();
363
+ };
364
+
365
+ env.addReporter({jasmineDone: assertions});
366
+ env.execute([spec.id, spec2.id]);
367
+ });
368
+
369
+ describe('focused runnables', function() {
370
+ it('runs the relevant alls and eachs for each runnable', function(done) {
371
+ var actions = [];
372
+ env.beforeAll(function() {actions.push('beforeAll')});
373
+ env.afterAll(function() {actions.push('afterAll')});
374
+ env.beforeEach(function() {actions.push('beforeEach')});
375
+ env.afterEach(function() {actions.push('afterEach')});
376
+
377
+ env.fdescribe('a focused suite', function() {
378
+ env.it('is run', function() {
379
+ actions.push('spec in fdescribe')
380
+ });
381
+ });
382
+
383
+ env.describe('an unfocused suite', function() {
384
+ env.fit('has a focused spec', function() {
385
+ actions.push('focused spec')
386
+ });
387
+ });
388
+
389
+ var assertions = function() {
390
+ var expected = [
391
+ 'beforeAll',
392
+ 'beforeEach',
393
+ 'spec in fdescribe',
394
+ 'afterEach',
395
+ 'afterAll',
396
+
397
+ 'beforeAll',
398
+ 'beforeEach',
399
+ 'focused spec',
400
+ 'afterEach',
401
+ 'afterAll'
402
+ ];
403
+ expect(actions).toEqual(expected);
404
+ done();
405
+ };
406
+
407
+ env.addReporter({jasmineDone: assertions});
408
+ env.execute();
409
+ });
410
+
411
+ it('focused specs in focused suites cause non-focused siblings to not run', function(done){
412
+ var actions = [];
413
+
414
+ env.fdescribe('focused suite', function() {
415
+ env.it('unfocused spec', function() {
416
+ actions.push('unfocused spec')
417
+ });
418
+ env.fit('focused spec', function() {
419
+ actions.push('focused spec')
420
+ });
421
+ });
422
+
423
+ var assertions = function() {
424
+ var expected = ['focused spec'];
425
+ expect(actions).toEqual(expected);
426
+ done();
427
+ };
428
+
429
+ env.addReporter({jasmineDone: assertions});
430
+ env.execute();
431
+ });
432
+
433
+ it('focused suites in focused suites cause non-focused siblings to not run', function(done){
434
+ var actions = [];
435
+
436
+ env.fdescribe('focused suite', function() {
437
+ env.it('unfocused spec', function() {
438
+ actions.push('unfocused spec')
439
+ });
440
+ env.fdescribe('inner focused suite', function() {
441
+ env.it('inner spec', function() {
442
+ actions.push('inner spec');
443
+ });
444
+ });
445
+ });
446
+
447
+ var assertions = function() {
448
+ var expected = ['inner spec'];
449
+ expect(actions).toEqual(expected);
450
+ done();
451
+ };
452
+
453
+ env.addReporter({jasmineDone: assertions});
454
+ env.execute();
455
+ });
456
+
457
+ it('focused runnables unfocus ancestor focused suites', function() {
458
+ var actions = [];
459
+
460
+ env.fdescribe('focused suite', function() {
461
+ env.it('unfocused spec', function() {
462
+ actions.push('unfocused spec')
463
+ });
464
+ env.describe('inner focused suite', function() {
465
+ env.fit('focused spec', function() {
466
+ actions.push('focused spec');
467
+ });
468
+ });
469
+ });
470
+
471
+ var assertions = function() {
472
+ var expected = ['focused spec'];
473
+ expect(actions).toEqual(expected);
474
+ done();
475
+ };
476
+
477
+ env.addReporter({jasmineDone: assertions});
478
+ env.execute();
479
+ });
480
+ });
481
+
231
482
  it("shouldn't run disabled suites", function(done) {
232
483
  var specInADisabledSuite = jasmine.createSpy("specInADisabledSuite"),
233
484
  suite = env.describe('A Suite', function() {
@@ -236,10 +487,36 @@ describe("jasmine spec running", function () {
236
487
  });
237
488
  });
238
489
 
239
- suite.execute(function() {
490
+ var assertions = function() {
240
491
  expect(specInADisabledSuite).not.toHaveBeenCalled();
241
492
  done();
493
+ };
494
+
495
+ env.addReporter({jasmineDone: assertions});
496
+
497
+ env.execute();
498
+ });
499
+
500
+ it("should allow top level suites to be disabled", function() {
501
+ var specInADisabledSuite = jasmine.createSpy("specInADisabledSuite"),
502
+ otherSpec = jasmine.createSpy("otherSpec");
503
+
504
+ env.xdescribe('A disabled suite', function() {
505
+ env.it('spec inside a disabled suite', specInADisabledSuite);
506
+ });
507
+ env.describe('Another suite', function() {
508
+ env.it('another spec', otherSpec);
242
509
  });
510
+
511
+ var assertions = function() {
512
+ expect(specInADisabledSuite).not.toHaveBeenCalled();
513
+ expect(otherSpec).toHaveBeenCalled();
514
+ done();
515
+ };
516
+
517
+ env.addReporter({jasmineDone: assertions});
518
+
519
+ env.execute();
243
520
  });
244
521
 
245
522
  it("should set all pending specs to pending when a suite is run", function(done) {
@@ -254,7 +531,6 @@ describe("jasmine spec running", function () {
254
531
  });
255
532
  });
256
533
 
257
-
258
534
  // TODO: is this useful? It doesn't catch syntax errors
259
535
  xit("should recover gracefully when there are errors in describe functions", function() {
260
536
  var specs = [];
@@ -174,7 +174,7 @@ describe("matchersUtil", function() {
174
174
 
175
175
  describe("contains", function() {
176
176
  it("passes when expected is a substring of actual", function() {
177
- expect(j$.matchersUtil.contains("ABC", "B")).toBe(true);
177
+ expect(j$.matchersUtil.contains("ABC", "BC")).toBe(true);
178
178
  });
179
179
 
180
180
  it("fails when expected is a not substring of actual", function() {
@@ -199,6 +199,23 @@ describe("matchersUtil", function() {
199
199
 
200
200
  expect(j$.matchersUtil.contains([1, 2], 2, [customTester])).toBe(true);
201
201
  });
202
+
203
+ it("fails when actual is undefined", function() {
204
+ expect(j$.matchersUtil.contains(undefined, 'A')).toBe(false);
205
+ });
206
+
207
+ it("fails when actual is null", function() {
208
+ expect(j$.matchersUtil.contains(null, 'A')).toBe(false);
209
+ });
210
+
211
+ it("passes with array-like objects", function() {
212
+ var capturedArgs = null;
213
+ function testFunction(){
214
+ capturedArgs = arguments;
215
+ }
216
+ testFunction('foo', 'bar');
217
+ expect(j$.matchersUtil.contains(capturedArgs, 'bar')).toBe(true);
218
+ });
202
219
  });
203
220
 
204
221
  describe("buildMessage", function() {
@@ -8,7 +8,8 @@ describe("toBeGreaterThan", function() {
8
8
  });
9
9
 
10
10
  it("fails when actual <= expected", function() {
11
- var matcher = j$.matchers.toBeGreaterThan();
11
+ var matcher = j$.matchers.toBeGreaterThan(),
12
+ result;
12
13
 
13
14
  result = matcher.compare(1, 1);
14
15
  expect(result.pass).toBe(false);
@@ -9,7 +9,8 @@ describe("toBeNaN", function() {
9
9
  });
10
10
 
11
11
  it("fails for anything not a NaN", function() {
12
- var matcher = j$.matchers.toBeNaN();
12
+ var matcher = j$.matchers.toBeNaN(),
13
+ result;
13
14
 
14
15
  result = matcher.compare(1);
15
16
  expect(result.pass).toBe(false);
@@ -31,6 +32,6 @@ describe("toBeNaN", function() {
31
32
  var matcher = j$.matchers.toBeNaN(),
32
33
  result = matcher.compare(0);
33
34
 
34
- expect(result.message).toEqual("Expected 0 to be NaN.");
35
+ expect(result.message()).toEqual("Expected 0 to be NaN.");
35
36
  });
36
37
  });
@@ -9,7 +9,8 @@ describe("toBeUndefined", function() {
9
9
  });
10
10
 
11
11
  it("fails when matching defined values", function() {
12
- var matcher = j$.matchers.toBeUndefined();
12
+ var matcher = j$.matchers.toBeUndefined(),
13
+ result;
13
14
 
14
15
  result = matcher.compare('foo');
15
16
  expect(result.pass).toBe(false);
@@ -3,7 +3,8 @@ describe("toContain", function() {
3
3
  var util = {
4
4
  contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
5
5
  },
6
- matcher = j$.matchers.toContain(util);
6
+ matcher = j$.matchers.toContain(util),
7
+ result;
7
8
 
8
9
  result = matcher.compare("ABC", "B");
9
10
  expect(util.contains).toHaveBeenCalledWith("ABC", "B", []);
@@ -15,7 +16,8 @@ describe("toContain", function() {
15
16
  contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
16
17
  },
17
18
  customEqualityTesters = ['a', 'b'],
18
- matcher = j$.matchers.toContain(util, customEqualityTesters);
19
+ matcher = j$.matchers.toContain(util, customEqualityTesters),
20
+ result;
19
21
 
20
22
  result = matcher.compare("ABC", "B");
21
23
  expect(util.contains).toHaveBeenCalledWith("ABC", "B", ['a', 'b']);
@@ -13,7 +13,8 @@ describe("toHaveBeenCalled", function() {
13
13
 
14
14
  it("fails when the actual was not called", function() {
15
15
  var matcher = j$.matchers.toHaveBeenCalled(),
16
- uncalledSpy = j$.createSpy('uncalled spy');
16
+ uncalledSpy = j$.createSpy('uncalled spy'),
17
+ result;
17
18
 
18
19
  result = matcher.compare(uncalledSpy);
19
20
  expect(result.pass).toBe(false);
@@ -11,7 +11,21 @@ describe("toHaveBeenCalledWith", function() {
11
11
  result = matcher.compare(calledSpy, 'a', 'b');
12
12
 
13
13
  expect(result.pass).toBe(true);
14
- expect(result.message).toEqual("Expected spy called-spy not to have been called with [ 'a', 'b' ] but it was.");
14
+ expect(result.message()).toEqual("Expected spy called-spy not to have been called with [ 'a', 'b' ] but it was.");
15
+ });
16
+
17
+ it("passes through the custom equality testers", function() {
18
+ var util = {
19
+ contains: jasmine.createSpy('delegated-contains').and.returnValue(true)
20
+ },
21
+ customEqualityTesters = [function() { return true; }],
22
+ matcher = j$.matchers.toHaveBeenCalledWith(util, customEqualityTesters),
23
+ calledSpy = j$.createSpy('called-spy');
24
+
25
+ calledSpy('a', 'b');
26
+ matcher.compare(calledSpy, 'a', 'b');
27
+
28
+ expect(util.contains).toHaveBeenCalledWith([['a', 'b']], ['a', 'b'], customEqualityTesters);
15
29
  });
16
30
 
17
31
  it("fails when the actual was not called", function() {
@@ -24,7 +38,7 @@ describe("toHaveBeenCalledWith", function() {
24
38
 
25
39
  result = matcher.compare(uncalledSpy);
26
40
  expect(result.pass).toBe(false);
27
- expect(result.message).toEqual("Expected spy uncalled spy to have been called with [ ] but it was never called.");
41
+ expect(result.message()).toEqual("Expected spy uncalled spy to have been called with [ ] but it was never called.");
28
42
  });
29
43
 
30
44
  it("fails when the actual was called with different parameters", function() {
@@ -40,7 +54,7 @@ describe("toHaveBeenCalledWith", function() {
40
54
  result = matcher.compare(calledSpy, 'a', 'b');
41
55
 
42
56
  expect(result.pass).toBe(false);
43
- expect(result.message).toEqual("Expected spy called spy to have been called with [ 'a', 'b' ] but actual calls were [ 'a' ], [ 'c', 'd' ].");
57
+ expect(result.message()).toEqual("Expected spy called spy to have been called with [ 'a', 'b' ] but actual calls were [ 'a' ], [ 'c', 'd' ].");
44
58
  });
45
59
 
46
60
  it("throws an exception when the actual is not a spy", function() {
@@ -62,7 +62,7 @@ describe("toThrowError", function() {
62
62
 
63
63
  result = matcher.compare(fn);
64
64
  expect(result.pass).toBe(false);
65
- expect(result.message).toEqual("Expected function to throw an Error, but it threw 4.");
65
+ expect(result.message()).toEqual("Expected function to throw an Error, but it threw 4.");
66
66
  });
67
67
 
68
68
  it("fails with the correct message if thrown is a falsy value", function() {
@@ -74,7 +74,7 @@ describe("toThrowError", function() {
74
74
 
75
75
  result = matcher.compare(fn);
76
76
  expect(result.pass).toBe(false);
77
- expect(result.message).toEqual("Expected function to throw an Error, but it threw undefined.");
77
+ expect(result.message()).toEqual("Expected function to throw an Error, but it threw undefined.");
78
78
  });
79
79
 
80
80
  it("passes if thrown is a type of Error, but there is no expected error", function() {
@@ -100,7 +100,7 @@ describe("toThrowError", function() {
100
100
  result = matcher.compare(fn, "foo");
101
101
 
102
102
  expect(result.pass).toBe(true);
103
- expect(result.message).toEqual("Expected function not to throw an exception with message 'foo'.");
103
+ expect(result.message()).toEqual("Expected function not to throw an exception with message 'foo'.");
104
104
  });
105
105
 
106
106
  it("fails if thrown is an Error and the expected is not the same message", function() {
@@ -113,7 +113,7 @@ describe("toThrowError", function() {
113
113
  result = matcher.compare(fn, "bar");
114
114
 
115
115
  expect(result.pass).toBe(false);
116
- expect(result.message).toEqual("Expected function to throw an exception with message 'bar', but it threw an exception with message 'foo'.");
116
+ expect(result.message()).toEqual("Expected function to throw an exception with message 'bar', but it threw an exception with message 'foo'.");
117
117
  });
118
118
 
119
119
  it("passes if thrown is an Error and the expected is a RegExp that matches the message", function() {
@@ -126,7 +126,7 @@ describe("toThrowError", function() {
126
126
  result = matcher.compare(fn, /long/);
127
127
 
128
128
  expect(result.pass).toBe(true);
129
- expect(result.message).toEqual("Expected function not to throw an exception with a message matching /long/.");
129
+ expect(result.message()).toEqual("Expected function not to throw an exception with a message matching /long/.");
130
130
  });
131
131
 
132
132
  it("fails if thrown is an Error and the expected is a RegExp that does not match the message", function() {
@@ -139,7 +139,7 @@ describe("toThrowError", function() {
139
139
  result = matcher.compare(fn, /foo/);
140
140
 
141
141
  expect(result.pass).toBe(false);
142
- expect(result.message).toEqual("Expected function to throw an exception with a message matching /foo/, but it threw an exception with message 'a long message'.");
142
+ expect(result.message()).toEqual("Expected function to throw an exception with a message matching /foo/, but it threw an exception with message 'a long message'.");
143
143
  });
144
144
 
145
145
  it("passes if thrown is an Error and the expected the same Error", function() {
@@ -155,7 +155,7 @@ describe("toThrowError", function() {
155
155
  result = matcher.compare(fn, Error);
156
156
 
157
157
  expect(result.pass).toBe(true);
158
- expect(result.message).toEqual("Expected function not to throw Error.");
158
+ expect(result.message()).toEqual("Expected function not to throw Error.");
159
159
  });
160
160
 
161
161
  it("passes if thrown is a custom error that takes arguments and the expected is the same error", function() {
@@ -175,7 +175,7 @@ describe("toThrowError", function() {
175
175
  result = matcher.compare(fn, CustomError);
176
176
 
177
177
  expect(result.pass).toBe(true);
178
- expect(result.message).toEqual("Expected function not to throw CustomError.");
178
+ expect(result.message()).toEqual("Expected function not to throw CustomError.");
179
179
  });
180
180
 
181
181
  it("fails if thrown is an Error and the expected is a different Error", function() {
@@ -191,7 +191,7 @@ describe("toThrowError", function() {
191
191
  result = matcher.compare(fn, TypeError);
192
192
 
193
193
  expect(result.pass).toBe(false);
194
- expect(result.message).toEqual("Expected function to throw TypeError, but it threw Error.");
194
+ expect(result.message()).toEqual("Expected function to throw TypeError, but it threw Error.");
195
195
  });
196
196
 
197
197
  it("passes if thrown is a type of Error and it is equal to the expected Error and message", function() {
@@ -207,7 +207,7 @@ describe("toThrowError", function() {
207
207
  result = matcher.compare(fn, TypeError, "foo");
208
208
 
209
209
  expect(result.pass).toBe(true);
210
- expect(result.message).toEqual("Expected function not to throw TypeError with message \"foo\".");
210
+ expect(result.message()).toEqual("Expected function not to throw TypeError with message 'foo'.");
211
211
  });
212
212
 
213
213
  it("passes if thrown is a custom error that takes arguments and it is equal to the expected custom error and message", function() {
@@ -227,7 +227,7 @@ describe("toThrowError", function() {
227
227
  result = matcher.compare(fn, CustomError, "foo");
228
228
 
229
229
  expect(result.pass).toBe(true);
230
- expect(result.message).toEqual("Expected function not to throw CustomError with message \"foo\".");
230
+ expect(result.message()).toEqual("Expected function not to throw CustomError with message 'foo'.");
231
231
  });
232
232
 
233
233
  it("fails if thrown is a type of Error and the expected is a different Error", function() {
@@ -243,7 +243,7 @@ describe("toThrowError", function() {
243
243
  result = matcher.compare(fn, TypeError, "bar");
244
244
 
245
245
  expect(result.pass).toBe(false);
246
- expect(result.message).toEqual("Expected function to throw TypeError with message \"bar\", but it threw TypeError with message \"foo\".");
246
+ expect(result.message()).toEqual("Expected function to throw TypeError with message 'bar', but it threw TypeError with message 'foo'.");
247
247
  });
248
248
 
249
249
  it("passes if thrown is a type of Error and has the same type as the expected Error and the message matches the expected message", function() {
@@ -259,7 +259,7 @@ describe("toThrowError", function() {
259
259
  result = matcher.compare(fn, TypeError, /foo/);
260
260
 
261
261
  expect(result.pass).toBe(true);
262
- expect(result.message).toEqual("Expected function not to throw TypeError with message matching /foo/.");
262
+ expect(result.message()).toEqual("Expected function not to throw TypeError with a message matching /foo/.");
263
263
  });
264
264
 
265
265
  it("fails if thrown is a type of Error and the expected is a different Error", function() {
@@ -275,6 +275,6 @@ describe("toThrowError", function() {
275
275
  result = matcher.compare(fn, TypeError, /bar/);
276
276
 
277
277
  expect(result.pass).toBe(false);
278
- expect(result.message).toEqual("Expected function to throw TypeError with message matching /bar/, but it threw TypeError with message \"foo\".");
278
+ expect(result.message()).toEqual("Expected function to throw TypeError with a message matching /bar/, but it threw TypeError with message 'foo'.");
279
279
  });
280
280
  });
@@ -34,7 +34,7 @@ describe("toThrow", function() {
34
34
  result = matcher.compare(fn);
35
35
 
36
36
  expect(result.pass).toBe(true);
37
- expect(result.message).toEqual("Expected function not to throw, but it threw 5.");
37
+ expect(result.message()).toEqual("Expected function not to throw, but it threw 5.");
38
38
  });
39
39
 
40
40
  it("passes even if what is thrown is falsy", function() {
@@ -46,7 +46,7 @@ describe("toThrow", function() {
46
46
 
47
47
  result = matcher.compare(fn);
48
48
  expect(result.pass).toBe(true);
49
- expect(result.message).toEqual("Expected function not to throw, but it threw undefined.");
49
+ expect(result.message()).toEqual("Expected function not to throw, but it threw undefined.");
50
50
  });
51
51
 
52
52
  it("passes if what is thrown is equivalent to what is expected", function() {
@@ -62,7 +62,7 @@ describe("toThrow", function() {
62
62
  result = matcher.compare(fn, 5);
63
63
 
64
64
  expect(result.pass).toBe(true);
65
- expect(result.message).toEqual("Expected function not to throw 5.");
65
+ expect(result.message()).toEqual("Expected function not to throw 5.");
66
66
  });
67
67
 
68
68
  it("fails if what is thrown is not equivalent to what is expected", function() {
@@ -78,7 +78,7 @@ describe("toThrow", function() {
78
78
  result = matcher.compare(fn, "foo");
79
79
 
80
80
  expect(result.pass).toBe(false);
81
- expect(result.message).toEqual("Expected function to throw 'foo', but it threw 5.");
81
+ expect(result.message()).toEqual("Expected function to throw 'foo', but it threw 5.");
82
82
  });
83
83
 
84
84
  it("fails if what is thrown is not equivalent to undefined", function() {
@@ -94,6 +94,6 @@ describe("toThrow", function() {
94
94
  result = matcher.compare(fn, void 0);
95
95
 
96
96
  expect(result.pass).toBe(false);
97
- expect(result.message).toEqual("Expected function to throw undefined, but it threw 5.");
97
+ expect(result.message()).toEqual("Expected function to throw undefined, but it threw 5.");
98
98
  });
99
99
  });
@@ -0,0 +1,7 @@
1
+ (function() {
2
+ // By the time onload is called, jasmineRequire will be redefined to point
3
+ // to the Jasmine source files (and not jasmine.js). So re-require
4
+ window.j$ = jasmineRequire.core(jasmineRequire);
5
+ jasmineRequire.html(j$);
6
+ jasmineRequire.console(jasmineRequire, j$);
7
+ })();
@@ -0,0 +1,33 @@
1
+ (function() {
2
+ var path = require("path"),
3
+ fs = require("fs");
4
+
5
+ var glob = require("glob");
6
+
7
+ var j$Require = require(path.join(__dirname, "../../src/core/requireCore.js"));
8
+
9
+ global.getJasmineRequireObj = function () {
10
+ return j$Require;
11
+ };
12
+
13
+ function extend(destination, source) {
14
+ for (var property in source) destination[property] = source[property];
15
+ return destination;
16
+ }
17
+
18
+ function getSourceFiles() {
19
+ var src_files = ['core/**/*.js', 'console/**/*.js', 'version.js'];
20
+ src_files.forEach(function(file) {
21
+ var filePath = path.join(__dirname, "../../", 'src/', file);
22
+ glob.sync(filePath).forEach(function(resolvedFile) {
23
+ require(resolvedFile);
24
+ });
25
+ });
26
+ }
27
+
28
+ extend(j$Require, require(path.join(__dirname,"../../src/console/requireConsole.js")));
29
+ getSourceFiles();
30
+ global.j$ = j$Require.core(j$Require);
31
+
32
+ j$Require.console(j$Require, j$);
33
+ })();