Comparing version 0.35.1 to 0.35.2
@@ -0,1 +1,9 @@ | ||
# es6-shim 0.35.2 (3 December 2016) | ||
* [Fix] ensure `document.all` is not treated as a non-object-coercible (#428) | ||
* [Performance] Use original map for data backing when possible (#429, #422) | ||
* [Dev Deps] update `es5-shim`, `eslint`, `@ljharb/eslint-config`, `jscs`, `jshint`, `mocha`, `promises-plus-tests`, `uglify-js` | ||
* [Tests] up to `node` `v7.2`, `v5.12`, `v4.6`; improve test matrix | ||
* [Tests] avoid function name inference in node 7+ | ||
* [Tests] add Firefox Nightly error messages to fix false failure | ||
# es6-shim 0.35.1 (12 May 2016) | ||
@@ -2,0 +10,0 @@ * [Fix] Functions are objects (#418) |
@@ -158,3 +158,3 @@ /*! | ||
var str = _call(functionToString, this); | ||
var match = _call(_strMatch, str, /\s*function\s+([^\(\s]*)\s*/); | ||
var match = _call(_strMatch, str, /\s*function\s+([^(\s]*)\s*/); | ||
var name = match && match[1]; | ||
@@ -161,0 +161,0 @@ Object.defineProperty(this, 'name', { |
{ | ||
"name": "es6-shim", | ||
"version": "0.35.1", | ||
"version": "0.35.2", | ||
"author": "Paul Miller (http://paulmillr.com)", | ||
@@ -26,4 +26,4 @@ "description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines", | ||
"scripts": { | ||
"pretest": "npm run --silent lint", | ||
"test": "evalmd *.md && npm run --silent tests-only", | ||
"pretest": "npm run --silent lint && evalmd *.md", | ||
"test": "npm run --silent tests-only", | ||
"tests-only": "npm run --silent test:shim && npm run --silent test:sham", | ||
@@ -73,5 +73,5 @@ "test:shim": "mocha test/*.js test/*/*.js", | ||
"chai": "^3.5.0", | ||
"es5-shim": "^4.5.8", | ||
"eslint": "^2.9.0", | ||
"@ljharb/eslint-config": "^4.0.0", | ||
"es5-shim": "^4.5.9", | ||
"eslint": "^3.11.1", | ||
"@ljharb/eslint-config": "^9.0.1", | ||
"grunt": "^0.4.5", | ||
@@ -81,10 +81,10 @@ "grunt-contrib-connect": "^1.0.2", | ||
"grunt-saucelabs": "^8.6.2", | ||
"jscs": "^3.0.3", | ||
"jshint": "^2.9.2", | ||
"mocha": "^2.4.5", | ||
"promises-aplus-tests": "^2.1.1", | ||
"jscs": "^3.0.7", | ||
"jshint": "^2.9.4", | ||
"mocha": "^3.2.0", | ||
"promises-aplus-tests": "^2.1.2", | ||
"promises-es6-tests": "^0.5.0", | ||
"uglify-js": "^2.6.2", | ||
"uglify-js": "2.7.3", | ||
"evalmd": "^0.0.17" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
/* global describe, it, expect, require */ | ||
var identity = function (x) { return x; }; | ||
@@ -21,3 +21,3 @@ describe('Function', function () { | ||
it('returns empty string for anonymous functions', function () { | ||
var anon = function () {}; | ||
var anon = identity(function () {}); | ||
expect(anon.name).to.equal(''); | ||
@@ -39,3 +39,3 @@ | ||
/* jshint evil: true */ | ||
var func = Function(''); | ||
var func = identity(Function('')); | ||
/* jshint evil: false */ | ||
@@ -42,0 +42,0 @@ expect(typeof func.name).to.equal('string'); |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, require, beforeEach, afterEach */ | ||
var runArrayTests = function (it) { | ||
@@ -49,3 +47,3 @@ 'use strict'; | ||
describe('.from()', function () { | ||
if (!Array.hasOwnProperty('from')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array, 'from')) { | ||
return it('exists', function () { | ||
@@ -261,2 +259,3 @@ expect(Array).to.have.property('from'); | ||
ifSupportsDescriptorsIt('works when Object.prototype has a throwing setter', function () { | ||
// TODO: breaks in Chrome 17, IE 9, Safari 5.1-6 | ||
var key = 10; | ||
@@ -269,3 +268,6 @@ /* eslint no-extend-native: 0 */ | ||
}); | ||
expect(function () { var arr = []; arr[key] = 42; }).to['throw'](EvalError); // assert thrower | ||
expect(function () { | ||
var arr = []; | ||
arr[key] = 42; | ||
}).to['throw'](EvalError); // assert thrower | ||
@@ -280,3 +282,3 @@ expect(function () { Array.from({ length: key + 1 }); }).not.to['throw'](); | ||
describe('.of()', function () { | ||
if (!Array.hasOwnProperty('of')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array, 'of')) { | ||
return it('exists', function () { | ||
@@ -334,3 +336,3 @@ expect(Array).to.have.property('of'); | ||
describe('#copyWithin()', function () { | ||
if (!Array.prototype.hasOwnProperty('copyWithin')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'copyWithin')) { | ||
return it('exists', function () { | ||
@@ -424,3 +426,3 @@ expect(Array.prototype).to.have.property('copyWithin'); | ||
describe('#find()', function () { | ||
if (!Array.prototype.hasOwnProperty('find')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'find')) { | ||
return it('exists', function () { | ||
@@ -524,3 +526,3 @@ expect(Array.prototype).to.have.property('find'); | ||
describe('#findIndex()', function () { | ||
if (!Array.prototype.hasOwnProperty('findIndex')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'findIndex')) { | ||
return it('exists', function () { | ||
@@ -624,3 +626,3 @@ expect(Array.prototype).to.have.property('findIndex'); | ||
describe('ArrayIterator', function () { | ||
if (!Array.prototype.hasOwnProperty('keys')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'keys')) { | ||
return it('can be tested', function () { | ||
@@ -651,3 +653,3 @@ expect(Array.prototype).to.have.property('keys'); | ||
describe('#keys()', function () { | ||
if (!Array.prototype.hasOwnProperty('keys')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'keys')) { | ||
return it('exists', function () { | ||
@@ -723,3 +725,3 @@ expect(Array.prototype).to.have.property('keys'); | ||
describe('#values()', function () { | ||
if (!Array.prototype.hasOwnProperty('values')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'values')) { | ||
return it('exists', function () { | ||
@@ -795,3 +797,3 @@ expect(Array.prototype).to.have.property('values'); | ||
describe('#entries()', function () { | ||
if (!Array.prototype.hasOwnProperty('entries')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'entries')) { | ||
return it('exists', function () { | ||
@@ -873,3 +875,3 @@ expect(Array.prototype).to.have.property('entries'); | ||
describe('#fill()', function () { | ||
if (!Array.prototype.hasOwnProperty('fill')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array.prototype, 'fill')) { | ||
return it('exists', function () { | ||
@@ -876,0 +878,0 @@ expect(Array.prototype).to.have.property('fill'); |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, require */ | ||
describe('Date', function () { | ||
@@ -4,0 +2,0 @@ it('when invalid, dates should toString to "Invalid Date"', function () { |
@@ -1,2 +0,1 @@ | ||
/* global describe, it, xit, expect, require */ | ||
describe('JSON', function () { | ||
@@ -3,0 +2,0 @@ var functionsHaveNames = (function foo() {}).name === 'foo'; |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, xit, expect, require, beforeEach, afterEach */ | ||
// Big thanks to V8 folks for test ideas. | ||
@@ -55,3 +53,3 @@ // v8/test/mjsunit/harmony/collections.js | ||
var prototypePropIsEnumerable = (function () {}).propertyIsEnumerable('prototype'); | ||
var prototypePropIsEnumerable = Object.prototype.propertyIsEnumerable.call(function () {}, 'prototype'); | ||
var expectNotEnumerable = function (object) { | ||
@@ -297,3 +295,3 @@ if (prototypePropIsEnumerable && typeof object === 'function') { | ||
describe('#keys()', function () { | ||
if (!Map.prototype.hasOwnProperty('keys')) { | ||
if (!Object.prototype.hasOwnProperty.call(Map.prototype, 'keys')) { | ||
return it('exists', function () { | ||
@@ -318,3 +316,3 @@ expect(Map.prototype).to.have.property('keys'); | ||
describe('#values()', function () { | ||
if (!Map.prototype.hasOwnProperty('values')) { | ||
if (!Object.prototype.hasOwnProperty.call(Map.prototype, 'values')) { | ||
return it('exists', function () { | ||
@@ -339,3 +337,3 @@ expect(Map.prototype).to.have.property('values'); | ||
describe('#entries()', function () { | ||
if (!Map.prototype.hasOwnProperty('entries')) { | ||
if (!Object.prototype.hasOwnProperty.call(Map.prototype, 'entries')) { | ||
return it('exists', function () { | ||
@@ -359,3 +357,3 @@ expect(Map.prototype).to.have.property('entries'); | ||
it('throws when called on a non-Map', function () { | ||
var expectedMessage = /^(Method )?Map.prototype.entries called on incompatible receiver |^entries method called on incompatible |^Cannot create a Map entry iterator for a non-Map object.|^Map\.prototype\.entries: 'this' is not a Map object$/; | ||
var expectedMessage = /^(Method )?Map.prototype.entries called on incompatible receiver |^entries method called on incompatible |^Cannot create a Map entry iterator for a non-Map object.|^Map\.prototype\.entries: 'this' is not a Map object$|^std_Map_iterator method called on incompatible \w+$/; | ||
var nonMaps = [true, false, 'abc', NaN, new Set([1, 2]), { a: true }, [1], Object('abc'), Object(NaN)]; | ||
@@ -362,0 +360,0 @@ nonMaps.forEach(function (nonMap) { |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, xit, expect, require */ | ||
var Assertion = expect().constructor; | ||
@@ -39,3 +37,3 @@ Assertion.prototype.almostEqual = function (obj, precision) { | ||
describe('.acosh()', function () { | ||
if (!Math.hasOwnProperty('acosh')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'acosh')) { | ||
return it('exists', function () { | ||
@@ -74,3 +72,3 @@ expect(Math).to.have.property('acosh'); | ||
describe('.asinh()', function () { | ||
if (!Math.hasOwnProperty('asinh')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'asinh')) { | ||
return it('exists', function () { | ||
@@ -117,3 +115,3 @@ expect(Math).to.have.property('asinh'); | ||
describe('.atanh()', function () { | ||
if (!Math.hasOwnProperty('atanh')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'atanh')) { | ||
return it('exists', function () { | ||
@@ -154,3 +152,3 @@ expect(Math).to.have.property('atanh'); | ||
describe('.cbrt()', function () { | ||
if (!Math.hasOwnProperty('cbrt')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'cbrt')) { | ||
return it('exists', function () { | ||
@@ -191,3 +189,3 @@ expect(Math).to.have.property('cbrt'); | ||
describe('.clz32()', function () { | ||
if (!Math.hasOwnProperty('clz32')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'clz32')) { | ||
return it('exists', function () { | ||
@@ -260,3 +258,3 @@ expect(Math).to.have.property('clz32'); | ||
describe('.cosh()', function () { | ||
if (!Math.hasOwnProperty('cosh')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'cosh')) { | ||
return it('exists', function () { | ||
@@ -305,3 +303,3 @@ expect(Math).to.have.property('cosh'); | ||
describe('.expm1()', function () { | ||
if (!Math.hasOwnProperty('expm1')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'expm1')) { | ||
return it('exists', function () { | ||
@@ -352,3 +350,3 @@ expect(Math).to.have.property('expm1'); | ||
describe('.hypot()', function () { | ||
if (!Math.hasOwnProperty('hypot')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'hypot')) { | ||
return it('exists', function () { | ||
@@ -409,3 +407,3 @@ expect(Math).to.have.property('hypot'); | ||
describe('.log2()', function () { | ||
if (!Math.hasOwnProperty('log2')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'log2')) { | ||
return it('exists', function () { | ||
@@ -447,3 +445,3 @@ expect(Math).to.have.property('log2'); | ||
describe('.log10', function () { | ||
if (!Math.hasOwnProperty('log10')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'log10')) { | ||
return it('exists', function () { | ||
@@ -482,3 +480,3 @@ expect(Math).to.have.property('log10'); | ||
describe('.log1p', function () { | ||
if (!Math.hasOwnProperty('log1p')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'log1p')) { | ||
return it('exists', function () { | ||
@@ -517,3 +515,3 @@ expect(Math).to.have.property('log1p'); | ||
describe('.sign()', function () { | ||
if (!Math.hasOwnProperty('sign')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'sign')) { | ||
return it('exists', function () { | ||
@@ -565,3 +563,3 @@ expect(Math).to.have.property('sign'); | ||
describe('.sinh()', function () { | ||
if (!Math.hasOwnProperty('sinh')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'sinh')) { | ||
return it('exists', function () { | ||
@@ -597,3 +595,3 @@ expect(Math).to.have.property('sinh'); | ||
describe('.tanh()', function () { | ||
if (!Math.hasOwnProperty('tanh')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'tanh')) { | ||
return it('exists', function () { | ||
@@ -632,3 +630,3 @@ expect(Math).to.have.property('tanh'); | ||
describe('.trunc()', function () { | ||
if (!Math.hasOwnProperty('trunc')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'trunc')) { | ||
return it('exists', function () { | ||
@@ -670,3 +668,3 @@ expect(Math).to.have.property('trunc'); | ||
describe('.imul()', function () { | ||
if (!Math.hasOwnProperty('imul')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'imul')) { | ||
return it('exists', function () { | ||
@@ -768,4 +766,4 @@ expect(Math).to.have.property('imul'); | ||
expect(Math.round(0.5)).not.to.equal(0); | ||
expect(Math.round(0.5 - EPSILON / 4)).to.equal(0); | ||
expect(Math.round(0 + EPSILON / 4)).to.equal(0); | ||
expect(Math.round(0.5 - (EPSILON / 4))).to.equal(0); | ||
expect(Math.round(0 + (EPSILON / 4))).to.equal(0); | ||
}); | ||
@@ -775,9 +773,9 @@ | ||
expect(Math.round(-0.5)).to.equal(0); | ||
expect(Math.round(-0.5 - EPSILON / 3.99)).not.to.equal(0); | ||
expect(isNegativeZero(Math.round(-0.5 + EPSILON / 3.99))).to.equal(true); | ||
expect(isNegativeZero(Math.round(0 - EPSILON / 3.99))).to.equal(true); | ||
expect(Math.round(-0.5 - (EPSILON / 3.99))).not.to.equal(0); | ||
expect(isNegativeZero(Math.round(-0.5 + (EPSILON / 3.99)))).to.equal(true); | ||
expect(isNegativeZero(Math.round(0 - (EPSILON / 3.99)))).to.equal(true); | ||
}); | ||
it('returns 1 / Number.EPSILON + 1 for 1 / Number.EPSILON + 1', function () { | ||
var inverseEpsilonPlus1 = 1 / EPSILON + 1; | ||
var inverseEpsilonPlus1 = (1 / EPSILON) + 1; | ||
expect(Math.round(inverseEpsilonPlus1)).to.equal(inverseEpsilonPlus1); | ||
@@ -787,3 +785,3 @@ }); | ||
it('returns 2 / Number.EPSILON - 1 for 2 / Number.EPSILON - 1', function () { | ||
var twiceInverseEpsilonMinus1 = 2 / EPSILON - 1; | ||
var twiceInverseEpsilonMinus1 = (2 / EPSILON) - 1; | ||
expect(Math.round(twiceInverseEpsilonMinus1)).to.equal(twiceInverseEpsilonMinus1); | ||
@@ -794,3 +792,3 @@ }); | ||
describe('.fround()', function () { | ||
if (!Math.hasOwnProperty('fround')) { | ||
if (!Object.prototype.hasOwnProperty.call(Math, 'fround')) { | ||
return it('exists', function () { | ||
@@ -855,3 +853,5 @@ expect(Math).to.have.property('fround'); | ||
expect(Math.fround(-maxFloat32)).to.equal(-maxFloat32); | ||
expect(Math.fround(maxFloat32 + Math.pow(2, Math.pow(2, 8 - 1) - 1 - 23 - 2))).to.equal(maxFloat32); // round-nearest rounds down to maxFloat32 | ||
// round-nearest rounds down to maxFloat32 | ||
expect(Math.fround(maxFloat32 + Math.pow(2, Math.pow(2, 8 - 1) - 1 - 23 - 2))).to.equal(maxFloat32); | ||
}); | ||
@@ -865,6 +865,6 @@ | ||
expect(Math.fround(-minFloat32 / 2)).to.equal(0); | ||
expect(Math.fround(minFloat32 / 2 + Math.pow(2, -202))).to.equal(minFloat32); | ||
expect(Math.fround(-minFloat32 / 2 - Math.pow(2, -202))).to.equal(-minFloat32); | ||
expect(Math.fround((minFloat32 / 2) + Math.pow(2, -202))).to.equal(minFloat32); | ||
expect(Math.fround((-minFloat32 / 2) - Math.pow(2, -202))).to.equal(-minFloat32); | ||
}); | ||
}); | ||
}); |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, xit, expect, require */ | ||
describe('Number', function () { | ||
@@ -52,3 +50,3 @@ var functionsHaveNames = (function foo() {}).name === 'foo'; | ||
expect(Number).to.have.property('MAX_SAFE_INTEGER'); | ||
expect(Number.propertyIsEnumerable('MAX_SAFE_INTEGER')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'MAX_SAFE_INTEGER')).to.equal(false); | ||
expect(Number.MAX_SAFE_INTEGER).to.equal(Math.pow(2, 53) - 1); | ||
@@ -59,3 +57,3 @@ }); | ||
expect(Number).to.have.property('MIN_SAFE_INTEGER'); | ||
expect(Number.propertyIsEnumerable('MIN_SAFE_INTEGER')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'MIN_SAFE_INTEGER')).to.equal(false); | ||
expect(Number.MIN_SAFE_INTEGER).to.equal(-Math.pow(2, 53) + 1); | ||
@@ -66,3 +64,3 @@ }); | ||
expect(Number).to.have.property('EPSILON'); | ||
expect(Number.propertyIsEnumerable('EPSILON')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'EPSILON')).to.equal(false); | ||
expect(Number.EPSILON).to.equal(2.2204460492503130808472633361816e-16); | ||
@@ -73,3 +71,3 @@ }); | ||
expect(Number).to.have.property('NaN'); | ||
expect(Number.propertyIsEnumerable('NaN')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'NaN')).to.equal(false); | ||
expect(isNaN(Number.NaN)).to.equal(true); | ||
@@ -80,3 +78,3 @@ }); | ||
expect(Number).to.have.property('MAX_VALUE'); | ||
expect(Number.propertyIsEnumerable('MAX_VALUE')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'MAX_VALUE')).to.equal(false); | ||
expect(Number.MAX_VALUE).to.equal(1.7976931348623157e+308); | ||
@@ -87,3 +85,3 @@ }); | ||
expect(Number).to.have.property('MIN_VALUE'); | ||
expect(Number.propertyIsEnumerable('MIN_VALUE')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'MIN_VALUE')).to.equal(false); | ||
expect(Number.MIN_VALUE).to.equal(5e-324); | ||
@@ -94,3 +92,3 @@ }); | ||
expect(Number).to.have.property('NEGATIVE_INFINITY'); | ||
expect(Number.propertyIsEnumerable('NEGATIVE_INFINITY')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'NEGATIVE_INFINITY')).to.equal(false); | ||
expect(Number.NEGATIVE_INFINITY).to.equal(-Infinity); | ||
@@ -101,3 +99,3 @@ }); | ||
expect(Number).to.have.property('POSITIVE_INFINITY'); | ||
expect(Number.propertyIsEnumerable('POSITIVE_INFINITY')).to.equal(false); | ||
expect(Object.prototype.propertyIsEnumerable.call(Number, 'POSITIVE_INFINITY')).to.equal(false); | ||
expect(Number.POSITIVE_INFINITY).to.equal(Infinity); | ||
@@ -108,3 +106,3 @@ }); | ||
describe('.parseInt()', function () { | ||
if (!Number.hasOwnProperty('parseInt')) { | ||
if (!Object.prototype.hasOwnProperty.call(Number, 'parseInt')) { | ||
return it('exists', function () { | ||
@@ -141,3 +139,3 @@ expect(Number).to.have.property('parseInt'); | ||
describe('.parseFloat()', function () { | ||
if (!Number.hasOwnProperty('parseFloat')) { | ||
if (!Object.prototype.hasOwnProperty.call(Number, 'parseFloat')) { | ||
return it('exists', function () { | ||
@@ -166,3 +164,3 @@ expect(Number).to.have.property('parseFloat'); | ||
describe('.isFinite()', function () { | ||
if (!Number.hasOwnProperty('isFinite')) { | ||
if (!Object.prototype.hasOwnProperty.call(Number, 'isFinite')) { | ||
return it('exists', function () { | ||
@@ -211,3 +209,3 @@ expect(Number).to.have.property('isFinite'); | ||
describe('.isInteger()', function () { | ||
if (!Number.hasOwnProperty('isInteger')) { | ||
if (!Object.prototype.hasOwnProperty.call(Number, 'isInteger')) { | ||
return it('exists', function () { | ||
@@ -274,3 +272,3 @@ expect(Number).to.have.property('isInteger'); | ||
describe('.isSafeInteger()', function () { | ||
if (!Number.hasOwnProperty('isSafeInteger')) { | ||
if (!Object.prototype.hasOwnProperty.call(Number, 'isSafeInteger')) { | ||
return it('exists', function () { | ||
@@ -337,3 +335,3 @@ expect(Number).to.have.property('isSafeInteger'); | ||
describe('.isNaN()', function () { | ||
if (!Number.hasOwnProperty('isNaN')) { | ||
if (!Object.prototype.hasOwnProperty.call(Number, 'isNaN')) { | ||
return it('exists', function () { | ||
@@ -473,3 +471,6 @@ expect(Number).to.have.property('isNaN'); | ||
expect(Number({ valueOf: function () { return '1.1'; }, toString: '2.2' })).to.equal(1.1); | ||
expect(Number({ valueOf: function () { return '1.1'; }, toString: function () { return '2.2'; } })).to.equal(1.1); | ||
expect(Number({ | ||
valueOf: function () { return '1.1'; }, | ||
toString: function () { return '2.2'; } | ||
})).to.equal(1.1); | ||
expect(String(Number({ valueOf: function () { return '-0x1a2b3c'; } }))).to.equal('NaN'); | ||
@@ -476,0 +477,0 @@ expect(String(Number({ toString: function () { return '-0x1a2b3c'; } }))).to.equal('NaN'); |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, xit, expect, require, Symbol */ | ||
describe('Object', function () { | ||
@@ -142,3 +140,3 @@ var ifShimIt = (typeof process !== 'undefined' && process.env.NO_ES6_SHIM) ? it.skip : it; | ||
describe('.is()', function () { | ||
if (!Object.hasOwnProperty('is')) { | ||
if (!Object.prototype.hasOwnProperty.call(Object, 'is')) { | ||
return it('exists', function () { | ||
@@ -175,3 +173,3 @@ expect(Object).to.have.property('is'); | ||
describe('.assign()', function () { | ||
if (!Object.hasOwnProperty('assign')) { | ||
if (!Object.prototype.hasOwnProperty.call(Object, 'assign')) { | ||
return it('exists', function () { | ||
@@ -280,3 +278,7 @@ expect(Object).to.have.property('assign'); | ||
var error; | ||
try { Object.assign(thrower, 'wxyz'); } catch (e) { error = e; } | ||
try { | ||
Object.assign(thrower, 'wxyz'); | ||
} catch (e) { | ||
error = e; | ||
} | ||
expect(thrower).not.to.have.property(0); | ||
@@ -295,2 +297,3 @@ if (thrower[1] === 'x') { | ||
ifSymbolsIt('includes enumerable symbols, after keys', function () { | ||
/* eslint max-statements-per-line: 1 */ | ||
var visited = []; | ||
@@ -300,5 +303,11 @@ var obj = {}; | ||
var symbol = Symbol('enumerable'); | ||
Object.defineProperty(obj, symbol, { get: function () { visited.push(symbol); return Infinity; }, enumerable: true }); | ||
Object.defineProperty(obj, symbol, { | ||
get: function () { visited.push(symbol); return Infinity; }, | ||
enumerable: true | ||
}); | ||
var nonEnumSymbol = Symbol('non-enumerable'); | ||
Object.defineProperty(obj, nonEnumSymbol, { get: function () { visited.push(nonEnumSymbol); return -Infinity; }, enumerable: false }); | ||
Object.defineProperty(obj, nonEnumSymbol, { | ||
get: function () { visited.push(nonEnumSymbol); return -Infinity; }, | ||
enumerable: false | ||
}); | ||
var target = Object.assign({}, obj); | ||
@@ -305,0 +314,0 @@ expect(visited).to.eql(['a', symbol]); |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, require, Promise */ | ||
/* This file is for testing implementation regressions of Promises. */ | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* global describe, specify, assert, Promise */ | ||
describe('Evil promises should not be able to break invariants', function () { | ||
@@ -4,0 +2,0 @@ 'use strict'; |
@@ -1,3 +0,1 @@ | ||
/* global describe, require, Promise */ | ||
// tests from promises-aplus-tests | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
/* global describe, require, Promise */ | ||
// tests from promises-es6-tests | ||
@@ -4,0 +2,0 @@ (function () { |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, setTimeout, assert, Promise */ | ||
var failIfThrows = function (done) { | ||
@@ -4,0 +2,0 @@ 'use strict'; |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, setTimeout, Promise */ | ||
var failIfThrows = function (done) { | ||
@@ -4,0 +2,0 @@ 'use strict'; |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, setTimeout, Promise */ | ||
var failIfThrows = function (done) { | ||
@@ -4,0 +2,0 @@ 'use strict'; |
@@ -1,3 +0,1 @@ | ||
/* global describe, specify, assert, Promise */ | ||
var failIfThrows = function (done) { | ||
@@ -4,0 +2,0 @@ 'use strict'; |
@@ -1,3 +0,1 @@ | ||
/* global describe, xdescribe, it, xit, expect, require, Reflect */ | ||
var arePropertyDescriptorsSupported = function () { | ||
@@ -4,0 +2,0 @@ try { |
@@ -1,3 +0,1 @@ | ||
/* global beforeEach, describe, it, expect, require */ | ||
var getRegexLiteral = function (stringRegex) { | ||
@@ -16,3 +14,3 @@ try { | ||
var ifShimIt = (typeof process !== 'undefined' && process.env.NO_ES6_SHIM) ? it.skip : it; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' && typeof Symbol() === 'symbol'; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' && typeof Symbol('') === 'symbol'; | ||
var ifSymbolsDescribe = hasSymbols ? describe : describe.skip; | ||
@@ -201,3 +199,3 @@ var defaultRegex = (function () { | ||
describeIfSupportsDescriptors('#flags', function () { | ||
if (!RegExp.prototype.hasOwnProperty('flags')) { | ||
if (!Object.prototype.hasOwnProperty.call(RegExp.prototype, 'flags')) { | ||
return it('exists', function () { | ||
@@ -231,6 +229,6 @@ expect(RegExp.prototype).to.have.property('flags'); | ||
expect((/a/m).flags).to.equal('m'); | ||
if (RegExp.prototype.hasOwnProperty('sticky')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'sticky')) { | ||
expect(getRegexLiteral('/a/y').flags).to.equal('y'); | ||
} | ||
if (RegExp.prototype.hasOwnProperty('unicode')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'unicode')) { | ||
expect(getRegexLiteral('/a/u').flags).to.equal('u'); | ||
@@ -244,6 +242,6 @@ } | ||
expect(new RegExp('a', 'm').flags).to.equal('m'); | ||
if (RegExp.prototype.hasOwnProperty('sticky')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'sticky')) { | ||
expect(new RegExp('a', 'y').flags).to.equal('y'); | ||
} | ||
if (RegExp.prototype.hasOwnProperty('unicode')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'unicode')) { | ||
expect(new RegExp('a', 'u').flags).to.equal('u'); | ||
@@ -257,6 +255,6 @@ } | ||
expect((/a/mgi).flags).to.equal('gim'); | ||
if (RegExp.prototype.hasOwnProperty('sticky')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'sticky')) { | ||
expect(getRegexLiteral('/a/gyim').flags).to.equal('gimy'); | ||
} | ||
if (RegExp.prototype.hasOwnProperty('unicode')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'unicode')) { | ||
expect(getRegexLiteral('/a/ugmi').flags).to.equal('gimu'); | ||
@@ -270,6 +268,6 @@ } | ||
expect(new RegExp('a', 'mgi').flags).to.equal('gim'); | ||
if (RegExp.prototype.hasOwnProperty('sticky')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'sticky')) { | ||
expect(new RegExp('a', 'mygi').flags).to.equal('gimy'); | ||
} | ||
if (RegExp.prototype.hasOwnProperty('unicode')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp.prototype, 'unicode')) { | ||
expect(new RegExp('a', 'mugi').flags).to.equal('gimu'); | ||
@@ -376,6 +374,6 @@ } | ||
it('has "multiline"', function () { | ||
if (RegExp.hasOwnProperty('multiline')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp, 'multiline')) { | ||
expect(RegExp.multiline).to.equal(false); | ||
} | ||
if (RegExp.hasOwnProperty('$*')) { | ||
if (Object.prototype.hasOwnProperty.call(RegExp, '$*')) { | ||
expect(RegExp['$*']).to.equal(false); | ||
@@ -382,0 +380,0 @@ } |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, xit, expect, require, beforeEach, afterEach */ | ||
// Big thanks to V8 folks for test ideas. | ||
@@ -59,3 +57,3 @@ // v8/test/mjsunit/harmony/collections.js | ||
var prototypePropIsEnumerable = (function () {}).propertyIsEnumerable('prototype'); | ||
var prototypePropIsEnumerable = Object.prototype.propertyIsEnumerable.call(function () {}, 'prototype'); | ||
var expectNotEnumerable = function (object) { | ||
@@ -293,3 +291,3 @@ if (prototypePropIsEnumerable && typeof object === 'function') { | ||
describe('#keys()', function () { | ||
if (!Set.prototype.hasOwnProperty('keys')) { | ||
if (!Object.prototype.hasOwnProperty.call(Set.prototype, 'keys')) { | ||
return it('exists', function () { | ||
@@ -318,3 +316,3 @@ expect(Set.prototype).to.have.property('keys'); | ||
describe('#values()', function () { | ||
if (!Set.prototype.hasOwnProperty('values')) { | ||
if (!Object.prototype.hasOwnProperty.call(Set.prototype, 'values')) { | ||
return it('exists', function () { | ||
@@ -338,3 +336,3 @@ expect(Set.prototype).to.have.property('values'); | ||
it('throws when called on a non-Set', function () { | ||
var expectedMessage = /^(Method )?Set.prototype.values called on incompatible receiver |^values method called on incompatible |^Cannot create a Set value iterator for a non-Set object.$|^Set.prototype.values: 'this' is not a Set object$/; | ||
var expectedMessage = /^(Method )?Set.prototype.values called on incompatible receiver |^values method called on incompatible |^Cannot create a Set value iterator for a non-Set object.$|^Set.prototype.values: 'this' is not a Set object$|^std_Set_iterator method called on incompatible \w+$/; | ||
var nonSets = [true, false, 'abc', NaN, new Map([[1, 2]]), { a: true }, [1], Object('abc'), Object(NaN)]; | ||
@@ -348,3 +346,3 @@ nonSets.forEach(function (nonSet) { | ||
describe('#entries()', function () { | ||
if (!Set.prototype.hasOwnProperty('entries')) { | ||
if (!Object.prototype.hasOwnProperty.call(Set.prototype, 'entries')) { | ||
return it('exists', function () { | ||
@@ -369,3 +367,3 @@ expect(Set.prototype).to.have.property('entries'); | ||
describe('#has()', function () { | ||
if (!Set.prototype.hasOwnProperty('has')) { | ||
if (!Object.prototype.hasOwnProperty.call(Set.prototype, 'has')) { | ||
return it('exists', function () { | ||
@@ -423,3 +421,3 @@ expect(Set.prototype).to.have.property('has'); | ||
describe('has an iterator that works with Array.from', function () { | ||
if (!Array.hasOwnProperty('from')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array, 'from')) { | ||
return it('requires Array.from to exist', function () { | ||
@@ -426,0 +424,0 @@ expect(Array).to.have.property('from'); |
@@ -1,3 +0,1 @@ | ||
/* global describe, it, expect, require */ | ||
var runStringTests = function (it) { | ||
@@ -29,3 +27,3 @@ 'use strict'; | ||
describe('#repeat()', function () { | ||
if (!String.prototype.hasOwnProperty('repeat')) { | ||
if (!Object.prototype.hasOwnProperty.call(String.prototype, 'repeat')) { | ||
return it('exists', function () { | ||
@@ -84,3 +82,3 @@ expect(String.prototype).to.have.property('repeat'); | ||
describe('#startsWith()', function () { | ||
if (!String.prototype.hasOwnProperty('startsWith')) { | ||
if (!Object.prototype.hasOwnProperty.call(String.prototype, 'startsWith')) { | ||
return it('exists', function () { | ||
@@ -208,3 +206,3 @@ expect(String.prototype).to.have.property('startsWith'); | ||
describe('#endsWith()', function () { | ||
if (!String.prototype.hasOwnProperty('endsWith')) { | ||
if (!Object.prototype.hasOwnProperty.call(String.prototype, 'endsWith')) { | ||
return it('exists', function () { | ||
@@ -335,3 +333,3 @@ expect(String.prototype).to.have.property('endsWith'); | ||
describe('#includes()', function () { | ||
if (!String.prototype.hasOwnProperty('includes')) { | ||
if (!Object.prototype.hasOwnProperty.call(String.prototype, 'includes')) { | ||
return it('exists', function () { | ||
@@ -451,3 +449,3 @@ expect(String.prototype).to.have.property('includes'); | ||
describe('.fromCodePoint()', function () { | ||
if (!String.hasOwnProperty('fromCodePoint')) { | ||
if (!Object.prototype.hasOwnProperty.call(String, 'fromCodePoint')) { | ||
return it('exists', function () { | ||
@@ -504,3 +502,3 @@ expect(String).to.have.property('fromCodePoint'); | ||
describe('#codePointAt()', function () { | ||
if (!String.prototype.hasOwnProperty('codePointAt')) { | ||
if (!Object.prototype.hasOwnProperty.call(String.prototype, 'codePointAt')) { | ||
return it('exists', function () { | ||
@@ -552,3 +550,3 @@ expect(String.prototype).to.have.property('codePointAt'); | ||
describe('#[Symbol.iterator]()', function () { | ||
if (!Array.hasOwnProperty('from')) { | ||
if (!Object.prototype.hasOwnProperty.call(Array, 'from')) { | ||
return it('requires Array.from to test', function () { | ||
@@ -573,3 +571,3 @@ expect(Array).to.have.property('from'); | ||
describe('.raw()', function () { | ||
if (!String.hasOwnProperty('raw')) { | ||
if (!Object.prototype.hasOwnProperty.call(String, 'raw')) { | ||
return it('exists', function () { | ||
@@ -599,2 +597,3 @@ expect(String).to.have.property('raw'); | ||
// eslint-disable-next-line no-template-curly-in-string | ||
str = 'The total is {total} (${total * 1.01} with tax)'; | ||
@@ -612,2 +611,3 @@ callSite.raw = ['The total is ', ' ($', ' with tax)']; | ||
// eslint-disable-next-line no-template-curly-in-string | ||
str = 'The total is {total} (${total * 1.01} with tax)'; | ||
@@ -634,3 +634,3 @@ callSite.raw = { 0: 'The total is ', 1: ' ($', 2: ' with tax)', length: 3 }; | ||
describe('#trim()', function () { | ||
if (!String.prototype.hasOwnProperty('trim')) { | ||
if (!Object.prototype.hasOwnProperty.call(String.prototype, 'trim')) { | ||
return it('exists', function () { | ||
@@ -780,3 +780,5 @@ expect(String.prototype).to.have.property('trim'); | ||
var obj = {}; | ||
obj[Symbol.replace] = function (string, replaceValue) { return string === str && replaceValue === replaceVal && this === obj; }; | ||
obj[Symbol.replace] = function (string, replaceValue) { | ||
return string === str && replaceValue === replaceVal && this === obj; | ||
}; | ||
expect(str.replace(obj, replaceVal)).to.equal(true); | ||
@@ -783,0 +785,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
/* global describe, it, expect, Worker, location */ | ||
/* globals Worker, location */ | ||
@@ -3,0 +3,0 @@ describe('Worker', function () { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
580615
54
10059