Skip to content

Commit

Permalink
test: add assert test for position indicator
Browse files Browse the repository at this point in the history
This test adds coverage for a ternary in assertion_error.js that checks
if stderr is a TTY.

PR-URL: nodejs#26024
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
  • Loading branch information
Trott committed Feb 12, 2019
1 parent 82c4e17 commit 40a8a73
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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.

0 comments on commit 40a8a73

Please sign in to comment.