jasmine-core 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd3280b6a0d81c805eeef4f84564ff0c24445e2f
4
- data.tar.gz: 6e9f101ec5eaa6e4a3ff21f58f1dd4b24a8fc8e4
3
+ metadata.gz: 604288a48f31c1b8ec0c2ef1ae8a1d8ac1fb5665
4
+ data.tar.gz: 29216a9fe0c2023a567bf18c7a792dac583fd7b6
5
5
  SHA512:
6
- metadata.gz: f6b17b1f24446517837fe42211d53a895cc7fe5cdfc496877a2daebd63a93ea7cf15dd3a4a0a68bf9e3ac43eed292af9037aeee35a15123e73636dd5bb83fdfb
7
- data.tar.gz: e6820d584ecb538969856468b4ed379940cc07f0bae32411e3a04728854df4c1ddf7fd12ee0dfff77e5784c7788461d5270a6610dae2ff1ec36a805b234d2353
6
+ metadata.gz: 4cf61a3211623e9432fe46f9e3b47bf6cb70b1476455306783b19eb5fb508be9d8ebed9d536137bbddd9753b1e08741f27e7315d2ce3ab8f6f907f2d6fc4d480
7
+ data.tar.gz: 3c0dbfd8dcbe158d6950fa35f01d6d0d34ceb6d62469d20800e8e61028e2c4c367d24ec256af60acbc52d835b749ef79b2f1ee27d8b8263851d43d5f48e6ec79
@@ -854,6 +854,10 @@ getJasmineRequireObj().Env = function(j$) {
854
854
  reporter.suiteStarted(suite.result);
855
855
  },
856
856
  nodeComplete: function(suite, result) {
857
+ if (suite !== currentSuite()) {
858
+ throw new Error('Tried to complete the wrong suite');
859
+ }
860
+
857
861
  if (!suite.markedPending) {
858
862
  clearResourcesForRunnable(suite.id);
859
863
  }
@@ -1601,11 +1605,22 @@ getJasmineRequireObj().clearStack = function(j$) {
1601
1605
  head = {},
1602
1606
  tail = head;
1603
1607
 
1608
+ var taskRunning = false;
1604
1609
  channel.port1.onmessage = function() {
1605
1610
  head = head.next;
1606
1611
  var task = head.task;
1607
1612
  delete head.task;
1608
- task();
1613
+
1614
+ if (taskRunning) {
1615
+ global.setTimeout(task, 0);
1616
+ } else {
1617
+ try {
1618
+ taskRunning = true;
1619
+ task();
1620
+ } finally {
1621
+ taskRunning = false;
1622
+ }
1623
+ }
1609
1624
  };
1610
1625
 
1611
1626
  return function clearStack(fn) {
@@ -2168,7 +2183,12 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
2168
2183
 
2169
2184
  var onerror = function onerror() {
2170
2185
  var handler = handlers[handlers.length - 1];
2171
- handler.apply(null, Array.prototype.slice.call(arguments, 0));
2186
+
2187
+ if (handler) {
2188
+ handler.apply(null, Array.prototype.slice.call(arguments, 0));
2189
+ } else {
2190
+ throw arguments[0];
2191
+ }
2172
2192
  };
2173
2193
 
2174
2194
  this.uninstall = function noop() {};
@@ -3823,6 +3843,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
3823
3843
  }
3824
3844
 
3825
3845
  QueueRunner.prototype.execute = function() {
3846
+ var self = this;
3847
+ this.handleFinalError = function(error) {
3848
+ self.onException(error);
3849
+ };
3850
+ this.globalErrors.pushListener(this.handleFinalError);
3826
3851
  this.run(this.queueableFns, 0);
3827
3852
  };
3828
3853
 
@@ -3842,7 +3867,10 @@ getJasmineRequireObj().QueueRunner = function(j$) {
3842
3867
  }
3843
3868
  }
3844
3869
 
3845
- this.clearStack(this.onComplete);
3870
+ this.clearStack(function() {
3871
+ self.globalErrors.popListener(self.handleFinalError);
3872
+ self.onComplete();
3873
+ });
3846
3874
 
3847
3875
  function attemptSync(queueableFn) {
3848
3876
  try {
@@ -4937,5 +4965,5 @@ getJasmineRequireObj().TreeProcessor = function() {
4937
4965
  };
4938
4966
 
4939
4967
  getJasmineRequireObj().version = function() {
4940
- return '2.6.1';
4968
+ return '2.6.2';
4941
4969
  };
@@ -37,6 +37,27 @@ describe("ClearStack", function() {
37
37
  expect(called).toBe(true);
38
38
  });
39
39
 
40
+ it("calls setTimeout when onmessage is called recursively", function() {
41
+ var fakeChannel = {
42
+ port1: {},
43
+ port2: { postMessage: function() { fakeChannel.port1.onmessage(); } }
44
+ },
45
+ setTimeout = jasmine.createSpy('setTimeout'),
46
+ global = {
47
+ MessageChannel: function() { return fakeChannel; },
48
+ setTimeout: setTimeout,
49
+ },
50
+ clearStack = jasmineUnderTest.getClearStack(global),
51
+ fn = jasmine.createSpy("second clearStack function");
52
+
53
+ clearStack(function() {
54
+ clearStack(fn);
55
+ });
56
+
57
+ expect(fn).not.toHaveBeenCalled();
58
+ expect(setTimeout).toHaveBeenCalledWith(fn, 0);
59
+ });
60
+
40
61
  it("falls back to setTimeout", function() {
41
62
  var setTimeout = jasmine.createSpy('setTimeout').and.callFake(function(fn) { fn() }),
42
63
  global = { setTimeout: setTimeout },
@@ -62,6 +62,22 @@ describe("GlobalErrors", function() {
62
62
  expect(fakeGlobal.onerror).toBe(originalCallback);
63
63
  });
64
64
 
65
+ it("rethrows the original error when there is no handler", function() {
66
+ var fakeGlobal = { },
67
+ errors = new jasmineUnderTest.GlobalErrors(fakeGlobal),
68
+ originalError = new Error('nope');
69
+
70
+ errors.install();
71
+
72
+ try {
73
+ fakeGlobal.onerror(originalError);
74
+ } catch (e) {
75
+ expect(e).toBe(originalError);
76
+ }
77
+
78
+ errors.uninstall();
79
+ });
80
+
65
81
  it("works in node.js", function() {
66
82
  var fakeGlobal = {
67
83
  process: {
@@ -252,7 +252,7 @@ describe("QueueRunner", function() {
252
252
 
253
253
  nextQueueableFn.fn.and.callFake(function() {
254
254
  // should remove the same function that was added
255
- expect(globalErrors.popListener).toHaveBeenCalledWith(globalErrors.pushListener.calls.argsFor(0)[0]);
255
+ expect(globalErrors.popListener).toHaveBeenCalledWith(globalErrors.pushListener.calls.argsFor(1)[0]);
256
256
  });
257
257
 
258
258
  queueRunner.execute();
@@ -314,6 +314,32 @@ describe("QueueRunner", function() {
314
314
  expect(nextQueueableFn.fn).toHaveBeenCalled();
315
315
  });
316
316
 
317
+ it("handles exceptions thrown while waiting for the stack to clear", function() {
318
+ var queueableFn = { fn: function(done) { done() } },
319
+ global = {},
320
+ errorListeners = [],
321
+ globalErrors = {
322
+ pushListener: function(f) { errorListeners.push(f); },
323
+ popListener: function() { errorListeners.pop(); }
324
+ },
325
+ clearStack = jasmine.createSpy('clearStack'),
326
+ onException = jasmine.createSpy('onException'),
327
+ queueRunner = new jasmineUnderTest.QueueRunner({
328
+ queueableFns: [queueableFn],
329
+ globalErrors: globalErrors,
330
+ clearStack: clearStack,
331
+ onException: onException
332
+ }),
333
+ error = new Error('nope');
334
+
335
+ queueRunner.execute();
336
+ expect(clearStack).toHaveBeenCalled();
337
+ expect(errorListeners.length).toEqual(1);
338
+ errorListeners[0](error);
339
+ clearStack.calls.argsFor(0)[0]();
340
+ expect(onException).toHaveBeenCalledWith(error);
341
+ });
342
+
317
343
  it("calls a provided complete callback when done", function() {
318
344
  var queueableFn = { fn: jasmine.createSpy('fn') },
319
345
  completeCallback = jasmine.createSpy('completeCallback'),
@@ -342,6 +368,8 @@ describe("QueueRunner", function() {
342
368
 
343
369
  queueRunner.execute();
344
370
  expect(afterFn.fn).toHaveBeenCalled();
345
- expect(clearStack).toHaveBeenCalledWith(completeCallback);
371
+ expect(clearStack).toHaveBeenCalled();
372
+ clearStack.calls.argsFor(0)[0]();
373
+ expect(completeCallback).toHaveBeenCalled();
346
374
  });
347
375
  });
@@ -456,6 +456,38 @@ describe("Env integration", function() {
456
456
  env.execute();
457
457
  });
458
458
 
459
+ it("copes with late async failures", function(done) {
460
+ var global = {
461
+ setTimeout: function(fn, delay) { setTimeout(fn, delay) },
462
+ clearTimeout: function(fn, delay) { clearTimeout(fn, delay) },
463
+ };
464
+ spyOn(jasmineUnderTest, 'getGlobal').and.returnValue(global);
465
+ var env = new jasmineUnderTest.Env(),
466
+ reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone", "suiteDone" ]);
467
+
468
+ reporter.jasmineDone.and.callFake(function() {
469
+ expect(reporter.suiteDone).toHaveFailedExpecationsForRunnable('A suite', ['fail thrown']);
470
+ done();
471
+ });
472
+
473
+ env.addReporter(reporter);
474
+
475
+ env.fdescribe('A suite', function() {
476
+ env.it('fails', function(specDone) {
477
+ specDone();
478
+ setTimeout(function() {
479
+ global.onerror('fail');
480
+ });
481
+ });
482
+ });
483
+
484
+ env.describe('Ignored', function() {
485
+ env.it('is not run', function() {});
486
+ });
487
+
488
+ env.execute();
489
+ });
490
+
459
491
  describe('suiteDone reporting', function(){
460
492
  it("reports when an afterAll fails an expectation", function(done) {
461
493
  var env = new jasmineUnderTest.Env(),
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module Jasmine
6
6
  module Core
7
- VERSION = "2.6.1"
7
+ VERSION = "2.6.2"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Van Hove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-26 00:00:00.000000000 Z
11
+ date: 2017-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake