jasmine-core 2.6.2 → 2.6.3

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: 604288a48f31c1b8ec0c2ef1ae8a1d8ac1fb5665
4
- data.tar.gz: 29216a9fe0c2023a567bf18c7a792dac583fd7b6
3
+ metadata.gz: 0204503a0e9c2cd889879c645c304d026a90e52b
4
+ data.tar.gz: 4a56201ba113f13b9d1880c1241266e00267fb56
5
5
  SHA512:
6
- metadata.gz: 4cf61a3211623e9432fe46f9e3b47bf6cb70b1476455306783b19eb5fb508be9d8ebed9d536137bbddd9753b1e08741f27e7315d2ce3ab8f6f907f2d6fc4d480
7
- data.tar.gz: 3c0dbfd8dcbe158d6950fa35f01d6d0d34ceb6d62469d20800e8e61028e2c4c367d24ec256af60acbc52d835b749ef79b2f1ee27d8b8263851d43d5f48e6ec79
6
+ metadata.gz: 42bef502da07b4a5a056353a0dec09c4a3ef666df94d5f3504c1ef244ddb65f7c86c87e7bc33b08e77e1cabf5faca4c5369c13cf37ec75937467096420d9fe8c
7
+ data.tar.gz: df306111e737b9d84a67cf9857896db6f1a322e522d73d12f3ac2f0f8813b64f92e31006ac63c35660ee9792e1d0790ca523f4121528a6d3944629e1f5b53725
@@ -3884,6 +3884,10 @@ getJasmineRequireObj().QueueRunner = function(j$) {
3884
3884
  var clearTimeout = function () {
3885
3885
  Function.prototype.apply.apply(self.timeout.clearTimeout, [j$.getGlobal(), [timeoutId]]);
3886
3886
  },
3887
+ completedSynchronously = true,
3888
+ setTimeout = function(delayedFn, delay) {
3889
+ return Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [delayedFn, delay]]);
3890
+ },
3887
3891
  handleError = function(error) {
3888
3892
  onException(error);
3889
3893
  next();
@@ -3891,7 +3895,13 @@ getJasmineRequireObj().QueueRunner = function(j$) {
3891
3895
  next = once(function () {
3892
3896
  clearTimeout(timeoutId);
3893
3897
  self.globalErrors.popListener(handleError);
3894
- self.run(queueableFns, iterativeIndex + 1);
3898
+ if (completedSynchronously) {
3899
+ setTimeout(function() {
3900
+ self.run(queueableFns, iterativeIndex + 1);
3901
+ });
3902
+ } else {
3903
+ self.run(queueableFns, iterativeIndex + 1);
3904
+ }
3895
3905
  }),
3896
3906
  timeoutId;
3897
3907
 
@@ -3903,15 +3913,16 @@ getJasmineRequireObj().QueueRunner = function(j$) {
3903
3913
  self.globalErrors.pushListener(handleError);
3904
3914
 
3905
3915
  if (queueableFn.timeout) {
3906
- timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
3916
+ timeoutId = setTimeout(function() {
3907
3917
  var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
3908
3918
  onException(error);
3909
3919
  next();
3910
- }, queueableFn.timeout()]]);
3920
+ }, queueableFn.timeout());
3911
3921
  }
3912
3922
 
3913
3923
  try {
3914
3924
  queueableFn.fn.call(self.userContext, next);
3925
+ completedSynchronously = false;
3915
3926
  } catch (e) {
3916
3927
  handleException(e, queueableFn);
3917
3928
  next();
@@ -4965,5 +4976,5 @@ getJasmineRequireObj().TreeProcessor = function() {
4965
4976
  };
4966
4977
 
4967
4978
  getJasmineRequireObj().version = function() {
4968
- return '2.6.2';
4979
+ return '2.6.3';
4969
4980
  };
@@ -170,6 +170,7 @@ describe("QueueRunner", function() {
170
170
 
171
171
  queueRunner.execute();
172
172
 
173
+ jasmine.clock().tick();
173
174
  expect(onComplete).toHaveBeenCalled();
174
175
  expect(onException).toHaveBeenCalled();
175
176
 
@@ -189,6 +190,7 @@ describe("QueueRunner", function() {
189
190
 
190
191
  queueRunner.execute();
191
192
 
193
+ jasmine.clock().tick(1);
192
194
  expect(onComplete).toHaveBeenCalled();
193
195
 
194
196
  jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
@@ -197,12 +199,13 @@ describe("QueueRunner", function() {
197
199
 
198
200
  it("only moves to the next spec the first time you call done", function() {
199
201
  var queueableFn = { fn: function(done) {done(); done();} },
200
- nextQueueableFn = { fn: jasmine.createSpy('nextFn') };
201
- queueRunner = new jasmineUnderTest.QueueRunner({
202
- queueableFns: [queueableFn, nextQueueableFn]
203
- });
202
+ nextQueueableFn = { fn: jasmine.createSpy('nextFn') },
203
+ queueRunner = new jasmineUnderTest.QueueRunner({
204
+ queueableFns: [queueableFn, nextQueueableFn]
205
+ });
204
206
 
205
207
  queueRunner.execute();
208
+ jasmine.clock().tick(1);
206
209
  expect(nextQueueableFn.fn.calls.count()).toEqual(1);
207
210
  });
208
211
 
@@ -211,10 +214,10 @@ describe("QueueRunner", function() {
211
214
  setTimeout(done, 1);
212
215
  throw new Error('error!');
213
216
  } },
214
- nextQueueableFn = { fn: jasmine.createSpy('nextFn') };
215
- queueRunner = new jasmineUnderTest.QueueRunner({
216
- queueableFns: [queueableFn, nextQueueableFn]
217
- });
217
+ nextQueueableFn = { fn: jasmine.createSpy('nextFn') },
218
+ queueRunner = new jasmineUnderTest.QueueRunner({
219
+ queueableFns: [queueableFn, nextQueueableFn]
220
+ });
218
221
 
219
222
  queueRunner.execute();
220
223
  jasmine.clock().tick(1);
@@ -271,6 +274,33 @@ describe("QueueRunner", function() {
271
274
  expect(onException).toHaveBeenCalledWith(errorWithMessage(/^foo$/));
272
275
  expect(nextQueueableFn.fn).toHaveBeenCalled();
273
276
  });
277
+
278
+ it("handles exceptions thrown while waiting for the stack to clear", function() {
279
+ var queueableFn = { fn: function(done) { done() } },
280
+ global = {},
281
+ errorListeners = [],
282
+ globalErrors = {
283
+ pushListener: function(f) { errorListeners.push(f); },
284
+ popListener: function() { errorListeners.pop(); }
285
+ },
286
+ clearStack = jasmine.createSpy('clearStack'),
287
+ onException = jasmine.createSpy('onException'),
288
+ queueRunner = new jasmineUnderTest.QueueRunner({
289
+ queueableFns: [queueableFn],
290
+ globalErrors: globalErrors,
291
+ clearStack: clearStack,
292
+ onException: onException
293
+ }),
294
+ error = new Error('nope');
295
+
296
+ queueRunner.execute();
297
+ jasmine.clock().tick();
298
+ expect(clearStack).toHaveBeenCalled();
299
+ expect(errorListeners.length).toEqual(1);
300
+ errorListeners[0](error);
301
+ clearStack.calls.argsFor(0)[0]();
302
+ expect(onException).toHaveBeenCalledWith(error);
303
+ });
274
304
  });
275
305
 
276
306
  it("calls exception handlers when an exception is thrown in a fn", function() {
@@ -306,38 +336,18 @@ describe("QueueRunner", function() {
306
336
  it("continues running the functions even after an exception is thrown in an async spec", function() {
307
337
  var queueableFn = { fn: function(done) { throw new Error("error"); } },
308
338
  nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
339
+ timeout = { setTimeout: jasmine.createSpy("setTimeout"),
340
+ clearTimeout: jasmine.createSpy("setTimeout")
341
+ },
309
342
  queueRunner = new jasmineUnderTest.QueueRunner({
310
- queueableFns: [queueableFn, nextQueueableFn]
343
+ queueableFns: [queueableFn, nextQueueableFn],
344
+ timeout: timeout
311
345
  });
312
346
 
313
347
  queueRunner.execute();
314
- expect(nextQueueableFn.fn).toHaveBeenCalled();
315
- });
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');
348
+ timeout.setTimeout.calls.argsFor(0)[0]();
334
349
 
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);
350
+ expect(nextQueueableFn.fn).toHaveBeenCalled();
341
351
  });
342
352
 
343
353
  it("calls a provided complete callback when done", function() {
@@ -353,23 +363,34 @@ describe("QueueRunner", function() {
353
363
  expect(completeCallback).toHaveBeenCalled();
354
364
  });
355
365
 
356
- it("calls a provided stack clearing function when done", function() {
357
- var asyncFn = { fn: function(done) { done() } },
358
- afterFn = { fn: jasmine.createSpy('afterFn') },
359
- completeCallback = jasmine.createSpy('completeCallback'),
360
- clearStack = jasmine.createSpy('clearStack'),
361
- queueRunner = new jasmineUnderTest.QueueRunner({
362
- queueableFns: [asyncFn, afterFn],
363
- clearStack: clearStack,
364
- onComplete: completeCallback
365
- });
366
+ describe("clearing the stack", function() {
367
+ beforeEach(function() {
368
+ jasmine.clock().install();
369
+ });
366
370
 
367
- clearStack.and.callFake(function(fn) { fn(); });
371
+ afterEach(function() {
372
+ jasmine.clock().uninstall();
373
+ });
368
374
 
369
- queueRunner.execute();
370
- expect(afterFn.fn).toHaveBeenCalled();
371
- expect(clearStack).toHaveBeenCalled();
372
- clearStack.calls.argsFor(0)[0]();
373
- expect(completeCallback).toHaveBeenCalled();
375
+ it("calls a provided stack clearing function when done", function() {
376
+ var asyncFn = { fn: function(done) { done() } },
377
+ afterFn = { fn: jasmine.createSpy('afterFn') },
378
+ completeCallback = jasmine.createSpy('completeCallback'),
379
+ clearStack = jasmine.createSpy('clearStack'),
380
+ queueRunner = new jasmineUnderTest.QueueRunner({
381
+ queueableFns: [asyncFn, afterFn],
382
+ clearStack: clearStack,
383
+ onComplete: completeCallback
384
+ });
385
+
386
+ clearStack.and.callFake(function(fn) { fn(); });
387
+
388
+ queueRunner.execute();
389
+ jasmine.clock().tick();
390
+ expect(afterFn.fn).toHaveBeenCalled();
391
+ expect(clearStack).toHaveBeenCalled();
392
+ clearStack.calls.argsFor(0)[0]();
393
+ expect(completeCallback).toHaveBeenCalled();
394
+ });
374
395
  });
375
396
  });
@@ -456,7 +456,7 @@ describe("Env integration", function() {
456
456
  env.execute();
457
457
  });
458
458
 
459
- it("copes with late async failures", function(done) {
459
+ it("copes with async failures after done has been called", function(done) {
460
460
  var global = {
461
461
  setTimeout: function(fn, delay) { setTimeout(fn, delay) },
462
462
  clearTimeout: function(fn, delay) { clearTimeout(fn, delay) },
@@ -466,6 +466,7 @@ describe("Env integration", function() {
466
466
  reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone", "suiteDone" ]);
467
467
 
468
468
  reporter.jasmineDone.and.callFake(function() {
469
+ expect(reporter.specDone).not.toHaveFailedExpecationsForRunnable('A suite fails', ['fail thrown']);
469
470
  expect(reporter.suiteDone).toHaveFailedExpecationsForRunnable('A suite', ['fail thrown']);
470
471
  done();
471
472
  });
@@ -474,9 +475,11 @@ describe("Env integration", function() {
474
475
 
475
476
  env.fdescribe('A suite', function() {
476
477
  env.it('fails', function(specDone) {
477
- specDone();
478
478
  setTimeout(function() {
479
- global.onerror('fail');
479
+ specDone();
480
+ setTimeout(function() {
481
+ global.onerror('fail');
482
+ });
480
483
  });
481
484
  });
482
485
  });
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module Jasmine
6
6
  module Core
7
- VERSION = "2.6.2"
7
+ VERSION = "2.6.3"
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.2
4
+ version: 2.6.3
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-05-18 00:00:00.000000000 Z
11
+ date: 2017-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake