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: #26024
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
  • Loading branch information
Trott authored and addaleax committed Feb 13, 2019
1 parent adaa2ae commit 61330b2
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 61330b2

Please sign in to comment.