Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! util: add coverage for util.inspect.colors alias setter
  • Loading branch information
Trott committed Feb 11, 2020
commit 333b75d726343ae41bb06d0e5e784251a840f2b5
11 changes: 9 additions & 2 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -2724,10 +2724,12 @@ assert.strictEqual(
);
}

// Test changing util.inspect.colors colors and aliases. Since this might have
// side effects, we do it last.
// Test changing util.inspect.colors colors and aliases.
{
Comment thread
Trott marked this conversation as resolved.
const colors = util.inspect.colors;

const originalValue = colors.gray;

// "grey" is reference-equal alias of "gray".
assert.strictEqual(colors.grey, colors.gray);

Expand All @@ -2740,4 +2742,9 @@ assert.strictEqual(
colors.grey = [1, 1];
assert.deepStrictEqual(colors.grey, [1, 1]);
assert.strictEqual(colors.grey, colors.gray);

// Restore original value to avoid side effects in other tests.
colors.gray = originalValue;
assert.deepStrictEqual(colors.gray, originalValue);
assert.strictEqual(colors.grey, colors.gray);
}