Skip to content

Commit cb530d2

Browse files
Trotttargos
authored andcommitted
test: increase coverage for util.inspect()
Confirm that own constructor value displays correctly. Refs: https://coverage.nodejs.org/coverage-0d468ab200584c3a/lib/internal/util/inspect.js.html#L550 PR-URL: #36228 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 2bbf253 commit cb530d2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/parallel/test-util-inspect.js

+20
Original file line numberDiff line numberDiff line change
@@ -3001,3 +3001,23 @@ assert.strictEqual(
30013001
// Consistency check.
30023002
assert(fullObjectGraph(global).has(Function.prototype));
30033003
}
3004+
3005+
{
3006+
// Confirm that own constructor value displays correctly.
3007+
3008+
function Fhqwhgads() {}
3009+
3010+
const sterrance = new Fhqwhgads();
3011+
sterrance.constructor = Fhqwhgads;
3012+
3013+
assert.strictEqual(
3014+
util.inspect(sterrance, { showHidden: true }),
3015+
'Fhqwhgads {\n' +
3016+
' constructor: <ref *1> [Function: Fhqwhgads] {\n' +
3017+
' [length]: 0,\n' +
3018+
" [name]: 'Fhqwhgads',\n" +
3019+
' [prototype]: { [constructor]: [Circular *1] }\n' +
3020+
' }\n' +
3021+
'}'
3022+
);
3023+
}

0 commit comments

Comments
 (0)