jasmine-core 2.6.0 → 2.6.1

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: 231c928de8539c661809a9e5a9d3a8d31b981cd4
4
- data.tar.gz: 62c0898fe4858367746ed1fb2f40e37d8bf557bc
3
+ metadata.gz: fd3280b6a0d81c805eeef4f84564ff0c24445e2f
4
+ data.tar.gz: 6e9f101ec5eaa6e4a3ff21f58f1dd4b24a8fc8e4
5
5
  SHA512:
6
- metadata.gz: c36ab7dc0f2853038ad35bfefb1de2fcd07f7c9d9da6ab2c7bd2d953890e04b76e4acd9bc8702cc64af95539801917e2bbd9e98ef08fe9e714322bed46ae2337
7
- data.tar.gz: 07f82fd21633dd4f0e305688b96b6294822995a29f840a160061bfbbffff2f1fb2a23d915f64c531344ae3033d4d0f1a7ae2f1a784698e552362b90188fa1589
6
+ metadata.gz: f6b17b1f24446517837fe42211d53a895cc7fe5cdfc496877a2daebd63a93ea7cf15dd3a4a0a68bf9e3ac43eed292af9037aeee35a15123e73636dd5bb83fdfb
7
+ data.tar.gz: e6820d584ecb538969856468b4ed379940cc07f0bae32411e3a04728854df4c1ddf7fd12ee0dfff77e5784c7788461d5270a6610dae2ff1ec36a805b234d2353
@@ -1068,7 +1068,7 @@ getJasmineRequireObj().Env = function(j$) {
1068
1068
  this.it = function(description, fn, timeout) {
1069
1069
  // it() sometimes doesn't have a fn argument, so only check the type if
1070
1070
  // it's given.
1071
- if (arguments.length > 1) {
1071
+ if (arguments.length > 1 && typeof fn !== 'undefined') {
1072
1072
  ensureIsFunction(fn, 'it');
1073
1073
  }
1074
1074
  var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
@@ -1082,7 +1082,7 @@ getJasmineRequireObj().Env = function(j$) {
1082
1082
  this.xit = function(description, fn, timeout) {
1083
1083
  // xit(), like it(), doesn't always have a fn argument, so only check the
1084
1084
  // type when needed.
1085
- if (arguments.length > 1) {
1085
+ if (arguments.length > 1 && typeof fn !== 'undefined') {
1086
1086
  ensureIsFunction(fn, 'xit');
1087
1087
  }
1088
1088
  var spec = this.it.apply(this, arguments);
@@ -1615,9 +1615,7 @@ getJasmineRequireObj().clearStack = function(j$) {
1615
1615
  }
1616
1616
 
1617
1617
  function getClearStack(global) {
1618
- if (global && global.process && j$.isFunction_(global.process.nextTick)) {
1619
- return global.process.nextTick;
1620
- } else if (j$.isFunction_(global.setImmediate)) {
1618
+ if (j$.isFunction_(global.setImmediate)) {
1621
1619
  var realSetImmediate = global.setImmediate;
1622
1620
  return function(fn) {
1623
1621
  realSetImmediate(fn);
@@ -2176,7 +2174,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
2176
2174
  this.uninstall = function noop() {};
2177
2175
 
2178
2176
  this.install = function install() {
2179
- if (global.process && j$.isFunction_(global.process.on)) {
2177
+ if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
2180
2178
  var originalHandlers = global.process.listeners('uncaughtException');
2181
2179
  global.process.removeAllListeners('uncaughtException');
2182
2180
  global.process.on('uncaughtException', onerror);
@@ -2572,8 +2570,8 @@ getJasmineRequireObj().matchersUtil = function(j$) {
2572
2570
  }
2573
2571
 
2574
2572
  var extraKeys = [];
2575
- for (var i in allKeys) {
2576
- if (!allKeys[i].match(/^[0-9]+$/)) {
2573
+ for (var i = 0; i < allKeys.length; i++) {
2574
+ if (!/^[0-9]+$/.test(allKeys[i])) {
2577
2575
  extraKeys.push(allKeys[i]);
2578
2576
  }
2579
2577
  }
@@ -4224,15 +4222,10 @@ getJasmineRequireObj().Spy = function (j$) {
4224
4222
  * @name Spy
4225
4223
  */
4226
4224
  function Spy(name, originalFn) {
4227
- var args = buildArgs(),
4228
- /*`eval` is the only option to preserve both this and context:
4229
- - former is needed to work as expected with methods,
4230
- - latter is needed to access real spy function and allows to reduce eval'ed code to absolute minimum
4231
- More explanation here (look at comments): http://www.bennadel.com/blog/1909-javascript-function-constructor-does-not-create-a-closure.htm
4232
- */
4233
- /* jshint evil: true */
4234
- wrapper = eval('(0, function (' + args + ') { return spy.apply(this, Array.prototype.slice.call(arguments)); })'),
4235
- /* jshint evil: false */
4225
+ var numArgs = (typeof originalFn === 'function' ? originalFn.length : 0),
4226
+ wrapper = makeFunc(numArgs, function () {
4227
+ return spy.apply(this, Array.prototype.slice.call(arguments));
4228
+ }),
4236
4229
  spyStrategy = new j$.SpyStrategy({
4237
4230
  name: name,
4238
4231
  fn: originalFn,
@@ -4261,14 +4254,19 @@ getJasmineRequireObj().Spy = function (j$) {
4261
4254
  return returnValue;
4262
4255
  };
4263
4256
 
4264
- function buildArgs() {
4265
- var args = [];
4266
-
4267
- while (originalFn instanceof Function && args.length < originalFn.length) {
4268
- args.push('arg' + args.length);
4257
+ function makeFunc(length, fn) {
4258
+ switch (length) {
4259
+ case 1 : return function (a) { return fn.apply(this, arguments); };
4260
+ case 2 : return function (a,b) { return fn.apply(this, arguments); };
4261
+ case 3 : return function (a,b,c) { return fn.apply(this, arguments); };
4262
+ case 4 : return function (a,b,c,d) { return fn.apply(this, arguments); };
4263
+ case 5 : return function (a,b,c,d,e) { return fn.apply(this, arguments); };
4264
+ case 6 : return function (a,b,c,d,e,f) { return fn.apply(this, arguments); };
4265
+ case 7 : return function (a,b,c,d,e,f,g) { return fn.apply(this, arguments); };
4266
+ case 8 : return function (a,b,c,d,e,f,g,h) { return fn.apply(this, arguments); };
4267
+ case 9 : return function (a,b,c,d,e,f,g,h,i) { return fn.apply(this, arguments); };
4268
+ default : return function () { return fn.apply(this, arguments); };
4269
4269
  }
4270
-
4271
- return args.join(', ');
4272
4270
  }
4273
4271
 
4274
4272
  for (var prop in originalFn) {
@@ -4939,5 +4937,5 @@ getJasmineRequireObj().TreeProcessor = function() {
4939
4937
  };
4940
4938
 
4941
4939
  getJasmineRequireObj().version = function() {
4942
- return '2.6.0';
4940
+ return '2.6.1';
4943
4941
  };
@@ -7,20 +7,6 @@ describe("ClearStack", function() {
7
7
  });
8
8
  });
9
9
 
10
- it("uses nextTick when available", function() {
11
- var nextTick = jasmine.createSpy('nextTick').and.callFake(function(fn) { fn() }),
12
- global = { process: { nextTick: nextTick } },
13
- clearStack = jasmineUnderTest.getClearStack(global),
14
- called = false;
15
-
16
- clearStack(function() {
17
- called = true;
18
- });
19
-
20
- expect(called).toBe(true);
21
- expect(nextTick).toHaveBeenCalled();
22
- });
23
-
24
10
  it("uses setImmediate when available", function() {
25
11
  var setImmediate = jasmine.createSpy('setImmediate').and.callFake(function(fn) { fn() }),
26
12
  global = { setImmediate: setImmediate },
@@ -82,8 +82,8 @@ describe("Env", function() {
82
82
  describe('#it', function () {
83
83
  it('throws an error when it receives a non-fn argument', function() {
84
84
  expect(function() {
85
- env.it('undefined arg', undefined);
86
- }).toThrowError(/it expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
85
+ env.it('undefined arg', null);
86
+ }).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
87
87
  });
88
88
 
89
89
  it('does not throw when it is not given a fn argument', function() {
@@ -105,8 +105,8 @@ describe("Env", function() {
105
105
 
106
106
  it('throws an error when it receives a non-fn argument', function() {
107
107
  expect(function() {
108
- env.xit('undefined arg', undefined);
109
- }).toThrowError(/xit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/);
108
+ env.xit('undefined arg', null);
109
+ }).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/);
110
110
  });
111
111
 
112
112
  it('does not throw when it is not given a fn argument', function() {
@@ -413,6 +413,53 @@ describe("matchersUtil", function() {
413
413
  var setB = new Set([6, 3]);
414
414
  expect(jasmineUnderTest.matchersUtil.equals(setA, setB)).toBe(false);
415
415
  });
416
+
417
+ describe("when running in an environment with array polyfills", function() {
418
+ // IE 8 doesn't support `definePropery` on non-DOM nodes
419
+ if (jasmine.getEnv().ieVersion < 9) { return; }
420
+
421
+ var findIndexDescriptor = Object.getOwnPropertyDescriptor(Array.prototype, 'findIndex');
422
+ if (!findIndexDescriptor) {
423
+ return;
424
+ }
425
+
426
+ beforeEach(function() {
427
+ Object.defineProperty(Array.prototype, 'findIndex', {
428
+ enumerable: true,
429
+ value: function (predicate) {
430
+ if (this === null) {
431
+ throw new TypeError('Array.prototype.findIndex called on null or undefined');
432
+ }
433
+
434
+ if (typeof predicate !== 'function') {
435
+ throw new TypeError('predicate must be a function');
436
+ }
437
+
438
+ var list = Object(this);
439
+ var length = list.length >>> 0;
440
+ var thisArg = arguments[1];
441
+ var value;
442
+
443
+ for (var i = 0; i < length; i++) {
444
+ value = list[i];
445
+ if (predicate.call(thisArg, value, i, list)) {
446
+ return i;
447
+ }
448
+ }
449
+
450
+ return -1;
451
+ }
452
+ });
453
+ });
454
+
455
+ afterEach(function() {
456
+ Object.defineProperty(Array.prototype, 'findIndex', findIndexDescriptor);
457
+ });
458
+
459
+ it("passes when there's an array polyfill", function() {
460
+ expect(['foo']).toEqual(['foo']);
461
+ });
462
+ });
416
463
  });
417
464
 
418
465
  describe("contains", function() {
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module Jasmine
6
6
  module Core
7
- VERSION = "2.6.0"
7
+ VERSION = "2.6.1"
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.0
4
+ version: 2.6.1
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-24 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake