Skip to content

Commit 95d2316

Browse files
committed
[Tests] cover util.inspect.custom
1 parent 7f9953a commit 95d2316

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.nycrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"check-coverage": true,
44
"instrumentation": false,
55
"sourceMap": false,
6-
"reporter": "html",
6+
"reporter": ["html", "text-summary"],
77
"lines": 94,
88
"statements": 94,
99
"functions": 96,

test/inspect.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
var inspect = require('../');
21
var test = require('tape');
2+
var hasSymbols = require('has-symbols')();
3+
var utilInspect = require('../util.inspect');
4+
5+
var inspect = require('..');
36

47
test('inspect', function (t) {
58
t.plan(1);
69
var obj = [{ inspect: function () { return '!XYZ¡'; } }, []];
710
t.equal(inspect(obj), '[ !XYZ¡, [] ]');
811
});
12+
13+
test('inspect custom symbol', { skip: !hasSymbols || !utilInspect }, function (t) {
14+
t.plan(1);
15+
16+
var obj = { inspect: function () { return 'string'; } };
17+
obj[utilInspect.custom] = function () { return 'symbol'; };
18+
19+
t.equal(inspect([obj, []]), '[ ' + (utilInspect.custom ? 'symbol' : 'string') + ', [] ]');
20+
});

0 commit comments

Comments
 (0)