🔧 npm update
This commit is contained in:
9
node_modules/object-inspect/test/quoteStyle.js
generated
vendored
9
node_modules/object-inspect/test/quoteStyle.js
generated
vendored
@@ -13,5 +13,14 @@ test('quoteStyle option', function (t) {
|
||||
t['throws'](function () { inspect(null, { quoteStyle: NaN }); }, 'NaN is not a valid value');
|
||||
t['throws'](function () { inspect(null, { quoteStyle: function () {} }); }, 'a function is not a valid value');
|
||||
|
||||
t.equal(inspect('"', { quoteStyle: 'single' }), '\'"\'', 'double quote, quoteStyle: "single"');
|
||||
t.equal(inspect('"', { quoteStyle: 'double' }), '"\\""', 'double quote, quoteStyle: "double"');
|
||||
|
||||
t.equal(inspect('\'', { quoteStyle: 'single' }), '\'\\\'\'', 'single quote, quoteStyle: "single"');
|
||||
t.equal(inspect('\'', { quoteStyle: 'double' }), '"\'"', 'single quote, quoteStyle: "double"');
|
||||
|
||||
t.equal(inspect('`', { quoteStyle: 'single' }), '\'`\'', 'backtick, quoteStyle: "single"');
|
||||
t.equal(inspect('`', { quoteStyle: 'double' }), '"`"', 'backtick, quoteStyle: "double"');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
50
node_modules/object-inspect/test/values.js
generated
vendored
50
node_modules/object-inspect/test/values.js
generated
vendored
@@ -5,6 +5,8 @@ var test = require('tape');
|
||||
var mockProperty = require('mock-property');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var hasToStringTag = require('has-tostringtag/shams')();
|
||||
var forEach = require('for-each');
|
||||
var semver = require('semver');
|
||||
|
||||
test('values', function (t) {
|
||||
t.plan(1);
|
||||
@@ -209,3 +211,51 @@ test('RegExps', function (t) {
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, function (t) {
|
||||
var target = { proxy: true };
|
||||
var fake = new Proxy(target, { has: function () { return false; } });
|
||||
|
||||
// needed to work around a weird difference in node v6.0 - v6.4 where non-present properties are not logged
|
||||
var isNode60 = semver.satisfies(process.version, '6.0 - 6.4');
|
||||
|
||||
forEach([
|
||||
'Boolean',
|
||||
'Number',
|
||||
'String',
|
||||
'Symbol',
|
||||
'Date'
|
||||
], function (tag) {
|
||||
target[Symbol.toStringTag] = tag;
|
||||
|
||||
t.equal(
|
||||
inspect(fake),
|
||||
'{ ' + (isNode60 ? '' : 'proxy: true, ') + '[Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
||||
'Proxy for + ' + tag + ' shows as the target, which has no slots'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('fakers', { skip: !hasToStringTag }, function (t) {
|
||||
var target = { proxy: false };
|
||||
|
||||
forEach([
|
||||
'Boolean',
|
||||
'Number',
|
||||
'String',
|
||||
'Symbol',
|
||||
'Date'
|
||||
], function (tag) {
|
||||
target[Symbol.toStringTag] = tag;
|
||||
|
||||
t.equal(
|
||||
inspect(target),
|
||||
'{ proxy: false, [Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
||||
'Object pretending to be ' + tag + ' does not trick us'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user