diff options
author | Rich Trott <rtrott@gmail.com> | 2019-02-09 20:57:36 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-02-11 22:57:21 -0800 |
commit | 40a8a7391664e7a5d8a264a1d85d059f9c05063b (patch) | |
tree | e1d0b4d20dbda6d6bf97b3feed7b0fb2fedf014c /test | |
parent | 82c4e170e5775ac0f3b4d14eba56a56f0c9126b4 (diff) | |
download | android-node-v8-40a8a7391664e7a5d8a264a1d85d059f9c05063b.tar.gz android-node-v8-40a8a7391664e7a5d8a264a1d85d059f9c05063b.tar.bz2 android-node-v8-40a8a7391664e7a5d8a264a1d85d059f9c05063b.zip |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/pseudo-tty/test-assert-position-indicator.js | 18 | ||||
-rw-r--r-- | test/pseudo-tty/test-assert-position-indicator.out | 0 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/pseudo-tty/test-assert-position-indicator.js b/test/pseudo-tty/test-assert-position-indicator.js new file mode 100644 index 0000000000..26f82b5b13 --- /dev/null +++ b/test/pseudo-tty/test-assert-position-indicator.js @@ -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('^') +); diff --git a/test/pseudo-tty/test-assert-position-indicator.out b/test/pseudo-tty/test-assert-position-indicator.out new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/pseudo-tty/test-assert-position-indicator.out |