Skip to content

Commit 61330b2

Browse files
Trottaddaleax
authored andcommitted
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: #26024 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
1 parent adaa2ae commit 61330b2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
5+
process.env.NODE_DISABLE_COLORS = true;
6+
process.stderr.columns = 20;
7+
8+
// Confirm that there is no position indicator.
9+
assert.throws(
10+
() => { assert.deepStrictEqual('a'.repeat(30), 'a'.repeat(31)); },
11+
(err) => !err.message.includes('^')
12+
);
13+
14+
// Confirm that there is a position indicator.
15+
assert.throws(
16+
() => { assert.deepStrictEqual('aaa', 'aaaa'); },
17+
(err) => err.message.includes('^')
18+
);

test/pseudo-tty/test-assert-position-indicator.out

Whitespace-only changes.

0 commit comments

Comments
 (0)