Update checked-in dependencies
This commit is contained in:
parent
6b0d45a5c6
commit
cc1adb825a
4247 changed files with 144820 additions and 149530 deletions
15
node_modules/object-inspect/test/bigint.js
generated
vendored
15
node_modules/object-inspect/test/bigint.js
generated
vendored
|
|
@ -1,5 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
|
||||
test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
|
||||
t.test('primitives', function (st) {
|
||||
|
|
@ -27,5 +30,17 @@ test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
|
|||
st.equal(inspect(Function('return 256n')()), '256n');
|
||||
});
|
||||
|
||||
t.test('toStringTag', { skip: !hasSymbols || typeof Symbol.toStringTag === 'undefined' }, function (st) {
|
||||
st.plan(1);
|
||||
|
||||
var faker = {};
|
||||
faker[Symbol.toStringTag] = 'BigInt';
|
||||
st.equal(
|
||||
inspect(faker),
|
||||
'{ [Symbol(Symbol.toStringTag)]: \'BigInt\' }',
|
||||
'object lying about being a BigInt inspects as an object'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
9
node_modules/object-inspect/test/circular.js
generated
vendored
9
node_modules/object-inspect/test/circular.js
generated
vendored
|
|
@ -2,8 +2,15 @@ var inspect = require('../');
|
|||
var test = require('tape');
|
||||
|
||||
test('circular', function (t) {
|
||||
t.plan(1);
|
||||
t.plan(2);
|
||||
var obj = { a: 1, b: [3, 4] };
|
||||
obj.c = obj;
|
||||
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
|
||||
|
||||
var double = {};
|
||||
double.a = [double];
|
||||
double.b = {};
|
||||
double.b.inner = double.b;
|
||||
double.b.obj = double;
|
||||
t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }');
|
||||
});
|
||||
|
|
|
|||
5
node_modules/object-inspect/test/deep.js
generated
vendored
5
node_modules/object-inspect/test/deep.js
generated
vendored
|
|
@ -2,8 +2,11 @@ var inspect = require('../');
|
|||
var test = require('tape');
|
||||
|
||||
test('deep', function (t) {
|
||||
t.plan(2);
|
||||
t.plan(4);
|
||||
var obj = [[[[[[500]]]]]];
|
||||
t.equal(inspect(obj), '[ [ [ [ [ [Array] ] ] ] ] ]');
|
||||
t.equal(inspect(obj, { depth: 4 }), '[ [ [ [ [Array] ] ] ] ]');
|
||||
t.equal(inspect(obj, { depth: 2 }), '[ [ [Array] ] ]');
|
||||
|
||||
t.equal(inspect([[[{ a: 1 }]]], { depth: 3 }), '[ [ [ [Object] ] ] ]');
|
||||
});
|
||||
|
|
|
|||
29
node_modules/object-inspect/test/fakes.js
generated
vendored
Normal file
29
node_modules/object-inspect/test/fakes.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var forEach = require('for-each');
|
||||
|
||||
test('fakes', { skip: !hasSymbols || typeof Symbol.toStringTag === 'undefined' }, function (t) {
|
||||
forEach([
|
||||
'Array',
|
||||
'Boolean',
|
||||
'Date',
|
||||
'Error',
|
||||
'Number',
|
||||
'RegExp',
|
||||
'String'
|
||||
], function (expected) {
|
||||
var faker = {};
|
||||
faker[Symbol.toStringTag] = expected;
|
||||
|
||||
t.equal(
|
||||
inspect(faker),
|
||||
'{ [Symbol(Symbol.toStringTag)]: \'' + expected + '\' }',
|
||||
'faker masquerading as ' + expected + ' is not shown as one'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
52
node_modules/object-inspect/test/fn.js
generated
vendored
52
node_modules/object-inspect/test/fn.js
generated
vendored
|
|
@ -1,5 +1,7 @@
|
|||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
var arrow = require('make-arrow-function')();
|
||||
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
|
||||
|
||||
test('function', function (t) {
|
||||
t.plan(1);
|
||||
|
|
@ -12,9 +14,9 @@ test('function name', function (t) {
|
|||
var f = (function () {
|
||||
return function () {};
|
||||
}());
|
||||
f.toString = function () { return 'function xxx () {}'; };
|
||||
f.toString = function toStr() { return 'function xxx () {}'; };
|
||||
var obj = [1, 2, f, 4];
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)], 4 ]');
|
||||
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)] { toString: [Function: toStr] }, 4 ]');
|
||||
});
|
||||
|
||||
test('anon function', function (t) {
|
||||
|
|
@ -26,3 +28,49 @@ test('anon function', function (t) {
|
|||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrow function', { skip: !arrow }, function (t) {
|
||||
t.equal(inspect(arrow), '[Function (anonymous)]');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('truly nameless function', { skip: !arrow || !functionsHaveConfigurableNames }, function (t) {
|
||||
function f() {}
|
||||
Object.defineProperty(f, 'name', { value: false });
|
||||
t.equal(f.name, false);
|
||||
t.equal(
|
||||
inspect(f),
|
||||
'[Function: f]',
|
||||
'named function with falsy `.name` does not hide its original name'
|
||||
);
|
||||
|
||||
function g() {}
|
||||
Object.defineProperty(g, 'name', { value: true });
|
||||
t.equal(g.name, true);
|
||||
t.equal(
|
||||
inspect(g),
|
||||
'[Function: true]',
|
||||
'named function with truthy `.name` hides its original name'
|
||||
);
|
||||
|
||||
var anon = function () {}; // eslint-disable-line func-style
|
||||
Object.defineProperty(anon, 'name', { value: null });
|
||||
t.equal(anon.name, null);
|
||||
t.equal(
|
||||
inspect(anon),
|
||||
'[Function (anonymous)]',
|
||||
'anon function with falsy `.name` does not hide its anonymity'
|
||||
);
|
||||
|
||||
var anon2 = function () {}; // eslint-disable-line func-style
|
||||
Object.defineProperty(anon2, 'name', { value: 1 });
|
||||
t.equal(anon2.name, 1);
|
||||
t.equal(
|
||||
inspect(anon2),
|
||||
'[Function: 1]',
|
||||
'anon function with truthy `.name` hides its anonymity'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
87
node_modules/object-inspect/test/inspect.js
generated
vendored
87
node_modules/object-inspect/test/inspect.js
generated
vendored
|
|
@ -1,35 +1,102 @@
|
|||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var utilInspect = require('../util.inspect');
|
||||
var repeat = require('string.prototype.repeat');
|
||||
|
||||
var inspect = require('..');
|
||||
|
||||
test('inspect', function (t) {
|
||||
t.plan(3);
|
||||
t.plan(5);
|
||||
|
||||
var obj = [{ inspect: function xyzInspect() { return '!XYZ¡'; } }, []];
|
||||
t.equal(inspect(obj), '[ !XYZ¡, [] ]');
|
||||
t.equal(inspect(obj, { customInspect: true }), '[ !XYZ¡, [] ]');
|
||||
t.equal(inspect(obj, { customInspect: false }), '[ { inspect: [Function: xyzInspect] }, [] ]');
|
||||
var stringResult = '[ !XYZ¡, [] ]';
|
||||
var falseResult = '[ { inspect: [Function: xyzInspect] }, [] ]';
|
||||
|
||||
t.equal(inspect(obj), stringResult);
|
||||
t.equal(inspect(obj, { customInspect: true }), stringResult);
|
||||
t.equal(inspect(obj, { customInspect: 'symbol' }), falseResult);
|
||||
t.equal(inspect(obj, { customInspect: false }), falseResult);
|
||||
t['throws'](
|
||||
function () { inspect(obj, { customInspect: 'not a boolean or "symbol"' }); },
|
||||
TypeError,
|
||||
'`customInspect` must be a boolean or the string "symbol"'
|
||||
);
|
||||
});
|
||||
|
||||
test('inspect custom symbol', { skip: !hasSymbols || !utilInspect || !utilInspect.custom }, function (t) {
|
||||
t.plan(3);
|
||||
t.plan(4);
|
||||
|
||||
var obj = { inspect: function stringInspect() { return 'string'; } };
|
||||
obj[utilInspect.custom] = function custom() { return 'symbol'; };
|
||||
|
||||
t.equal(inspect([obj, []]), '[ ' + (utilInspect.custom ? 'symbol' : 'string') + ', [] ]');
|
||||
t.equal(inspect([obj, []], { customInspect: true }), '[ ' + (utilInspect.custom ? 'symbol' : 'string') + ', [] ]');
|
||||
t.equal(inspect([obj, []], { customInspect: false }), '[ { inspect: [Function: stringInspect] }, [] ]');
|
||||
var symbolResult = '[ symbol, [] ]';
|
||||
var stringResult = '[ string, [] ]';
|
||||
var falseResult = '[ { inspect: [Function: stringInspect]' + (utilInspect.custom ? ', [' + inspect(utilInspect.custom) + ']: [Function: custom]' : '') + ' }, [] ]';
|
||||
|
||||
var symbolStringFallback = utilInspect.custom ? symbolResult : stringResult;
|
||||
var symbolFalseFallback = utilInspect.custom ? symbolResult : falseResult;
|
||||
|
||||
t.equal(inspect([obj, []]), symbolStringFallback);
|
||||
t.equal(inspect([obj, []], { customInspect: true }), symbolStringFallback);
|
||||
t.equal(inspect([obj, []], { customInspect: 'symbol' }), symbolFalseFallback);
|
||||
t.equal(inspect([obj, []], { customInspect: false }), falseResult);
|
||||
});
|
||||
|
||||
test('symbols', { skip: !hasSymbols }, function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var obj = { a: 1 };
|
||||
obj[Symbol('test')] = 2;
|
||||
obj[Symbol.iterator] = 3;
|
||||
Object.defineProperty(obj, Symbol('non-enum'), {
|
||||
enumerable: false,
|
||||
value: 4
|
||||
});
|
||||
|
||||
if (typeof Symbol.iterator === 'symbol') {
|
||||
t.equal(inspect(obj), '{ a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }', 'object with symbols');
|
||||
t.equal(inspect([obj, []]), '[ { a: 1, [Symbol(test)]: 2, [Symbol(Symbol.iterator)]: 3 }, [] ]', 'object with symbols in array');
|
||||
} else {
|
||||
// symbol sham key ordering is unreliable
|
||||
t.match(
|
||||
inspect(obj),
|
||||
/^(?:{ a: 1, \[Symbol\(test\)\]: 2, \[Symbol\(Symbol.iterator\)\]: 3 }|{ a: 1, \[Symbol\(Symbol.iterator\)\]: 3, \[Symbol\(test\)\]: 2 })$/,
|
||||
'object with symbols (nondeterministic symbol sham key ordering)'
|
||||
);
|
||||
t.match(
|
||||
inspect([obj, []]),
|
||||
/^\[ (?:{ a: 1, \[Symbol\(test\)\]: 2, \[Symbol\(Symbol.iterator\)\]: 3 }|{ a: 1, \[Symbol\(Symbol.iterator\)\]: 3, \[Symbol\(test\)\]: 2 }), \[\] \]$/,
|
||||
'object with symbols in array (nondeterministic symbol sham key ordering)'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('maxStringLength', function (t) {
|
||||
t['throws'](
|
||||
function () { inspect('', { maxStringLength: -1 }); },
|
||||
TypeError,
|
||||
'maxStringLength must be >= 0, or Infinity, not negative'
|
||||
);
|
||||
|
||||
var str = repeat('a', 1e8);
|
||||
|
||||
t.equal(
|
||||
inspect([repeat('a', 1e8)], { maxStringLength: 10 }),
|
||||
inspect([str], { maxStringLength: 10 }),
|
||||
'[ \'aaaaaaaaaa\'... 99999990 more characters ]',
|
||||
'maxStringLength option limits output'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
inspect(['f'], { maxStringLength: null }),
|
||||
'[ \'\'... 1 more character ]',
|
||||
'maxStringLength option accepts `null`'
|
||||
);
|
||||
|
||||
t.equal(
|
||||
inspect([str], { maxStringLength: Infinity }),
|
||||
'[ \'' + str + '\' ]',
|
||||
'maxStringLength option accepts ∞'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
2
node_modules/object-inspect/test/lowbyte.js
generated
vendored
2
node_modules/object-inspect/test/lowbyte.js
generated
vendored
|
|
@ -7,6 +7,6 @@ test('interpolate low bytes', function (t) {
|
|||
t.plan(1);
|
||||
t.equal(
|
||||
inspect(obj),
|
||||
"{ x: 'a\\r\\nb', y: '\\x05! \\x1f \\x12' }"
|
||||
"{ x: 'a\\r\\nb', y: '\\x05! \\x1F \\x12' }"
|
||||
);
|
||||
});
|
||||
|
|
|
|||
40
node_modules/object-inspect/test/toStringTag.js
generated
vendored
Normal file
40
node_modules/object-inspect/test/toStringTag.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
|
||||
var inspect = require('../');
|
||||
|
||||
test('Symbol.toStringTag', { skip: !hasSymbols || typeof Symbol.toStringTag === 'undefined' }, function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var obj = { a: 1 };
|
||||
t.equal(inspect(obj), '{ a: 1 }', 'object, no Symbol.toStringTag');
|
||||
|
||||
obj[Symbol.toStringTag] = 'foo';
|
||||
t.equal(inspect(obj), '{ a: 1, [Symbol(Symbol.toStringTag)]: \'foo\' }', 'object with Symbol.toStringTag');
|
||||
|
||||
t.test('null objects', { skip: 'toString' in { __proto__: null } }, function (st) {
|
||||
st.plan(2);
|
||||
|
||||
var dict = { __proto__: null, a: 1 };
|
||||
st.equal(inspect(dict), '[Object: null prototype] { a: 1 }', 'null object with Symbol.toStringTag');
|
||||
|
||||
dict[Symbol.toStringTag] = 'Dict';
|
||||
st.equal(inspect(dict), '[Dict: null prototype] { a: 1, [Symbol(Symbol.toStringTag)]: \'Dict\' }', 'null object with Symbol.toStringTag');
|
||||
});
|
||||
|
||||
t.test('instances', function (st) {
|
||||
st.plan(4);
|
||||
|
||||
function C() {
|
||||
this.a = 1;
|
||||
}
|
||||
st.equal(Object.prototype.toString.call(new C()), '[object Object]', 'instance, no toStringTag, Object.prototype.toString');
|
||||
st.equal(inspect(new C()), 'C { a: 1 }', 'instance, no toStringTag');
|
||||
|
||||
C.prototype[Symbol.toStringTag] = 'Class!';
|
||||
st.equal(Object.prototype.toString.call(new C()), '[object Class!]', 'instance, with toStringTag, Object.prototype.toString');
|
||||
st.equal(inspect(new C()), 'C [Class!] { a: 1 }', 'instance, with toStringTag');
|
||||
});
|
||||
});
|
||||
43
node_modules/object-inspect/test/values.js
generated
vendored
43
node_modules/object-inspect/test/values.js
generated
vendored
|
|
@ -1,5 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var inspect = require('../');
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
|
||||
test('values', function (t) {
|
||||
t.plan(1);
|
||||
|
|
@ -65,10 +68,26 @@ test('seen seen seen', function (t) {
|
|||
);
|
||||
});
|
||||
|
||||
test('symbols', { skip: typeof Symbol !== 'function' }, function (t) {
|
||||
test('symbols', { skip: !hasSymbols }, function (t) {
|
||||
var sym = Symbol('foo');
|
||||
t.equal(inspect(sym), 'Symbol(foo)', 'Symbol("foo") should be "Symbol(foo)"');
|
||||
t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"');
|
||||
if (typeof sym === 'symbol') {
|
||||
// Symbol shams are incapable of differentiating boxed from unboxed symbols
|
||||
t.equal(inspect(Object(sym)), 'Object(Symbol(foo))', 'Object(Symbol("foo")) should be "Object(Symbol(foo))"');
|
||||
}
|
||||
|
||||
t.test('toStringTag', { skip: !hasSymbols || typeof Symbol.toStringTag === 'undefined' }, function (st) {
|
||||
st.plan(1);
|
||||
|
||||
var faker = {};
|
||||
faker[Symbol.toStringTag] = 'Symbol';
|
||||
st.equal(
|
||||
inspect(faker),
|
||||
'{ [Symbol(Symbol.toStringTag)]: \'Symbol\' }',
|
||||
'object lying about being a Symbol inspects as an object'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
@ -123,6 +142,22 @@ test('WeakSet', { skip: typeof WeakSet !== 'function' }, function (t) {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('WeakRef', { skip: typeof WeakRef !== 'function' }, function (t) {
|
||||
var ref = new WeakRef({ a: 1 });
|
||||
var expectedString = 'WeakRef { ? }';
|
||||
t.equal(inspect(ref), expectedString, 'new WeakRef({ a: 1 }) should not show contents');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('FinalizationRegistry', { skip: typeof FinalizationRegistry !== 'function' }, function (t) {
|
||||
var registry = new FinalizationRegistry(function () {});
|
||||
var expectedString = 'FinalizationRegistry [FinalizationRegistry] {}';
|
||||
t.equal(inspect(registry), expectedString, 'new FinalizationRegistry(function () {}) should work normallys');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Strings', function (t) {
|
||||
var str = 'abc';
|
||||
|
||||
|
|
@ -167,5 +202,9 @@ test('RegExps', function (t) {
|
|||
t.equal(inspect(/a/g), '/a/g', 'regex shows properly');
|
||||
t.equal(inspect(new RegExp('abc', 'i')), '/abc/i', 'new RegExp shows properly');
|
||||
|
||||
var match = 'abc abc'.match(/[ab]+/);
|
||||
delete match.groups; // for node < 10
|
||||
t.equal(inspect(match), '[ \'ab\', index: 0, input: \'abc abc\' ]', 'RegExp match object shows properly');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue