mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
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. PR-URL: https://github.com/nodejs/node/pull/26024 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
parent
82c4e170e5
commit
40a8a73916
18
test/pseudo-tty/test-assert-position-indicator.js
Normal file
18
test/pseudo-tty/test-assert-position-indicator.js
Normal file
@ -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('^')
|
||||
);
|
0
test/pseudo-tty/test-assert-position-indicator.out
Normal file
0
test/pseudo-tty/test-assert-position-indicator.out
Normal file
Loading…
Reference in New Issue
Block a user