GeezerVison is showing github.com — test: skip some console tests on dumb terminal · nodejs/node@302408e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/common/README.md +8Lines changed: 8 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -223,6 +223,10 @@ Platform check for Advanced Interactive eXecutive (AIX). | 223 | 223 |
| 224 | 224 | Attempts to 'kill' `pid` | 225 | 225 |
| | 226 | +### `isDumbTerminal` | | 227 | + | | 228 | +* [<boolean>][] | | 229 | + | 226 | 230 | ### `isFreeBSD` | 227 | 231 |
| 228 | 232 | * [<boolean>][] | @@ -385,6 +389,10 @@ will not be run. | 385 | 389 |
| 386 | 390 | Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`. | 387 | 391 |
| | 392 | +### `skipIfDumbTerminal()` | | 393 | + | | 394 | +Skip the rest of the tests if the current terminal is a dumb terminal | | 395 | + | 388 | 396 | ### `skipIfEslintMissing()` | 389 | 397 |
| 390 | 398 | Skip the rest of the tests in the current file when `ESLint` is not available | |
Collapse file Copy file name to clipboardExpand all lines: test/common/index.js +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -112,6 +112,8 @@ const isOpenBSD = process.platform === 'openbsd'; | 112 | 112 | const isLinux = process.platform === 'linux'; | 113 | 113 | const isOSX = process.platform === 'darwin'; | 114 | 114 |
| | 115 | +const isDumbTerminal = process.env.TERM === 'dumb'; | | 116 | + | 115 | 117 | const rootDir = isWindows ? 'c:\\' : '/'; | 116 | 118 |
| 117 | 119 | const buildType = process.config.target_defaults ? | @@ -653,6 +655,12 @@ function invalidArgTypeHelper(input) { | 653 | 655 | return ` Received type ${typeof input} (${inspected})`; | 654 | 656 | } | 655 | 657 |
| | 658 | +function skipIfDumbTerminal() { | | 659 | + if (isDumbTerminal) { | | 660 | + skip('skipping - dumb terminal'); | | 661 | + } | | 662 | +} | | 663 | + | 656 | 664 | const common = { | 657 | 665 | allowGlobals, | 658 | 666 | buildType, | @@ -672,6 +680,7 @@ const common = { | 672 | 680 | invalidArgTypeHelper, | 673 | 681 | isAIX, | 674 | 682 | isAlive, | | 683 | + isDumbTerminal, | 675 | 684 | isFreeBSD, | 676 | 685 | isLinux, | 677 | 686 | isMainThread, | @@ -692,6 +701,7 @@ const common = { | 692 | 701 | runWithInvalidFD, | 693 | 702 | skip, | 694 | 703 | skipIf32Bits, | | 704 | + skipIfDumbTerminal, | 695 | 705 | skipIfEslintMissing, | 696 | 706 | skipIfInspectorDisabled, | 697 | 707 | skipIfWorker, | |
Collapse file Copy file name to clipboardExpand all lines: test/common/index.mjs +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,7 @@ const { | 12 | 12 | isIBMi, | 13 | 13 | isLinuxPPCBE, | 14 | 14 | isSunOS, | | 15 | + isDumbTerminal, | 15 | 16 | isFreeBSD, | 16 | 17 | isOpenBSD, | 17 | 18 | isLinux, | @@ -31,6 +32,7 @@ const { | 31 | 32 | mustCall, | 32 | 33 | mustCallAtLeast, | 33 | 34 | hasMultiLocalhost, | | 35 | + skipIfDumbTerminal, | 34 | 36 | skipIfEslintMissing, | 35 | 37 | canCreateSymLink, | 36 | 38 | getCallSite, | @@ -57,6 +59,7 @@ export { | 57 | 59 | isIBMi, | 58 | 60 | isLinuxPPCBE, | 59 | 61 | isSunOS, | | 62 | + isDumbTerminal, | 60 | 63 | isFreeBSD, | 61 | 64 | isOpenBSD, | 62 | 65 | isLinux, | @@ -76,6 +79,7 @@ export { | 76 | 79 | mustCall, | 77 | 80 | mustCallAtLeast, | 78 | 81 | hasMultiLocalhost, | | 82 | + skipIfDumbTerminal, | 79 | 83 | skipIfEslintMissing, | 80 | 84 | canCreateSymLink, | 81 | 85 | getCallSite, | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-console-clear.js +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 |
| 3 | | -require('../common'); | | 3 | +const common = require('../common'); | 4 | 4 | const assert = require('assert'); | 5 | 5 |
| 6 | 6 | const stdoutWrite = process.stdout.write; | @@ -18,5 +18,7 @@ function doTest(isTTY, check) { | 18 | 18 | } | 19 | 19 |
| 20 | 20 | // Fake TTY | 21 | | -doTest(true, check); | | 21 | +if (!common.isDumbTerminal) { | | 22 | + doTest(true, check); | | 23 | +} | 22 | 24 | doTest(false, ''); |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline-interface.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | // Flags: --expose-internals | 23 | 23 | 'use strict'; | 24 | 24 | const common = require('../common'); | | 25 | +common.skipIfDumbTerminal(); | 25 | 26 |
| 26 | 27 | const assert = require('assert'); | 27 | 28 | const readline = require('readline'); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline-position.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // Flags: --expose-internals | 2 | 2 | 'use strict'; | 3 | | -require('../common'); | | 3 | +const common = require('../common'); | 4 | 4 | const { internalBinding } = require('internal/test/binding'); | 5 | 5 | const { PassThrough } = require('stream'); | 6 | 6 | const readline = require('readline'); | 7 | 7 | const assert = require('assert'); | 8 | 8 |
| 9 | 9 | const ctrlU = { ctrl: true, name: 'u' }; | 10 | 10 |
| | 11 | +common.skipIfDumbTerminal(); | | 12 | + | 11 | 13 | { | 12 | 14 | const input = new PassThrough(); | 13 | 15 | const rl = readline.createInterface({ | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline-tab-complete.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,6 +8,8 @@ const assert = require('assert'); | 8 | 8 | const EventEmitter = require('events').EventEmitter; | 9 | 9 | const { getStringWidth } = require('internal/util/inspect'); | 10 | 10 |
| | 11 | +common.skipIfDumbTerminal(); | | 12 | + | 11 | 13 | // This test verifies that the tab completion supports unicode and the writes | 12 | 14 | // are limited to the minimum. | 13 | 15 | [ | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline-undefined-columns.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,8 @@ const assert = require('assert'); | 5 | 5 | const PassThrough = require('stream').PassThrough; | 6 | 6 | const readline = require('readline'); | 7 | 7 |
| | 8 | +common.skipIfDumbTerminal(); | | 9 | + | 8 | 10 | // Checks that tab completion still works | 9 | 11 | // when output column size is undefined | 10 | 12 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-readline.js +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,8 @@ const { PassThrough } = require('stream'); | 4 | 4 | const readline = require('readline'); | 5 | 5 | const assert = require('assert'); | 6 | 6 |
| | 7 | +common.skipIfDumbTerminal(); | | 8 | + | 7 | 9 | { | 8 | 10 | const input = new PassThrough(); | 9 | 11 | const rl = readline.createInterface({ | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-repl-editor.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 |
| 3 | | -require('../common'); | | 3 | +const common = require('../common'); | 4 | 4 | const assert = require('assert'); | 5 | 5 | const repl = require('repl'); | 6 | 6 | const ArrayStream = require('../common/arraystream'); | 7 | 7 |
| | 8 | +common.skipIfDumbTerminal(); | | 9 | + | 8 | 10 | // \u001b[nG - Moves the cursor to n st column | 9 | 11 | // \u001b[0J - Clear screen | 10 | 12 | // \u001b[0K - Clear to line end | |
|