Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
test: add assert test for position indicator
This test adds coverage for a ternary in assertion_error.js that checks
if stderr is a TTY.
  • Loading branch information
Trott committed Feb 10, 2019
commit 8d9d083d2cdc110bccc84536f66c4d941768a57b
18 changes: 18 additions & 0 deletions test/pseudo-tty/test-assert-position-indicator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';
require('../common');
const assert = require('assert');

process.env.NODE_DISABLE_COLORS = true;
process.stderr.columns = 20;

// Confirm that there is no position indicator.
assert.throws(
() => { assert.deepStrictEqual('a'.repeat(30), 'a'.repeat(31)); },
(err) => !err.message.includes('^')
);

// Confirm that there is a position indicator.
assert.throws(
() => { assert.deepStrictEqual('aaa', 'aaaa'); },
(err) => err.message.includes('^')
);
Empty file.