test: skip some console tests on dumb terminal
Add capabilities to common test module to detect and skip tests on dumb terminals. In some of our build environments, like s390x, the terminal is a dumb terminal meaning it has very rudimentary capabilities. These in turn prevent some of the tests from completing with errors as below. not ok 1777 parallel/test-readline-tab-complete --- duration_ms: 0.365 severity: fail exitcode: 1 stack: |- assert.js:103 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: '\t' !== '' at /home/abuild/rpmbuild/BUILD/node-git.8698dd98bb/test/parallel/test-readline-tab-complete.js:63:14 at Array.forEach (<anonymous>) at /home/abuild/rpmbuild/BUILD/node-git.8698dd98bb/test/parallel/test-readline-tab-complete.js:18:17 at Array.forEach (<anonymous>) at Object.<anonymous> (/home/abuild/rpmbuild/BUILD/node-git.8698dd98bb/test/parallel/test-readline-tab-complete.js:17:3) at Module._compile (internal/modules/cjs/loader.js:1176:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10) at Module.load (internal/modules/cjs/loader.js:1040:32) at Function.Module._load (internal/modules/cjs/loader.js:929:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) { generatedMessage: true, code: 'ERR_ASSERTION', actual: '\t', expected: '', operator: 'strictEqual' } ... PR-URL: https://github.com/nodejs/node/pull/33165 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
4d4e3c3674
commit
df8db42082
@ -223,6 +223,10 @@ Platform check for Advanced Interactive eXecutive (AIX).
|
|||||||
|
|
||||||
Attempts to 'kill' `pid`
|
Attempts to 'kill' `pid`
|
||||||
|
|
||||||
|
### `isDumbTerminal`
|
||||||
|
|
||||||
|
* [<boolean>][]
|
||||||
|
|
||||||
### `isFreeBSD`
|
### `isFreeBSD`
|
||||||
|
|
||||||
* [<boolean>][]
|
* [<boolean>][]
|
||||||
@ -385,6 +389,10 @@ will not be run.
|
|||||||
|
|
||||||
Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`.
|
Logs '1..0 # Skipped: ' + `msg` and exits with exit code `0`.
|
||||||
|
|
||||||
|
### `skipIfDumbTerminal()`
|
||||||
|
|
||||||
|
Skip the rest of the tests if the current terminal is a dumb terminal
|
||||||
|
|
||||||
### `skipIfEslintMissing()`
|
### `skipIfEslintMissing()`
|
||||||
|
|
||||||
Skip the rest of the tests in the current file when `ESLint` is not available
|
Skip the rest of the tests in the current file when `ESLint` is not available
|
||||||
|
@ -112,6 +112,8 @@ const isOpenBSD = process.platform === 'openbsd';
|
|||||||
const isLinux = process.platform === 'linux';
|
const isLinux = process.platform === 'linux';
|
||||||
const isOSX = process.platform === 'darwin';
|
const isOSX = process.platform === 'darwin';
|
||||||
|
|
||||||
|
const isDumbTerminal = process.env.TERM === 'dumb';
|
||||||
|
|
||||||
const rootDir = isWindows ? 'c:\\' : '/';
|
const rootDir = isWindows ? 'c:\\' : '/';
|
||||||
|
|
||||||
const buildType = process.config.target_defaults ?
|
const buildType = process.config.target_defaults ?
|
||||||
@ -653,6 +655,12 @@ function invalidArgTypeHelper(input) {
|
|||||||
return ` Received type ${typeof input} (${inspected})`;
|
return ` Received type ${typeof input} (${inspected})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function skipIfDumbTerminal() {
|
||||||
|
if (isDumbTerminal) {
|
||||||
|
skip('skipping - dumb terminal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const common = {
|
const common = {
|
||||||
allowGlobals,
|
allowGlobals,
|
||||||
buildType,
|
buildType,
|
||||||
@ -672,6 +680,7 @@ const common = {
|
|||||||
invalidArgTypeHelper,
|
invalidArgTypeHelper,
|
||||||
isAIX,
|
isAIX,
|
||||||
isAlive,
|
isAlive,
|
||||||
|
isDumbTerminal,
|
||||||
isFreeBSD,
|
isFreeBSD,
|
||||||
isLinux,
|
isLinux,
|
||||||
isMainThread,
|
isMainThread,
|
||||||
@ -692,6 +701,7 @@ const common = {
|
|||||||
runWithInvalidFD,
|
runWithInvalidFD,
|
||||||
skip,
|
skip,
|
||||||
skipIf32Bits,
|
skipIf32Bits,
|
||||||
|
skipIfDumbTerminal,
|
||||||
skipIfEslintMissing,
|
skipIfEslintMissing,
|
||||||
skipIfInspectorDisabled,
|
skipIfInspectorDisabled,
|
||||||
skipIfWorker,
|
skipIfWorker,
|
||||||
|
@ -12,6 +12,7 @@ const {
|
|||||||
isIBMi,
|
isIBMi,
|
||||||
isLinuxPPCBE,
|
isLinuxPPCBE,
|
||||||
isSunOS,
|
isSunOS,
|
||||||
|
isDumbTerminal,
|
||||||
isFreeBSD,
|
isFreeBSD,
|
||||||
isOpenBSD,
|
isOpenBSD,
|
||||||
isLinux,
|
isLinux,
|
||||||
@ -31,6 +32,7 @@ const {
|
|||||||
mustCall,
|
mustCall,
|
||||||
mustCallAtLeast,
|
mustCallAtLeast,
|
||||||
hasMultiLocalhost,
|
hasMultiLocalhost,
|
||||||
|
skipIfDumbTerminal,
|
||||||
skipIfEslintMissing,
|
skipIfEslintMissing,
|
||||||
canCreateSymLink,
|
canCreateSymLink,
|
||||||
getCallSite,
|
getCallSite,
|
||||||
@ -57,6 +59,7 @@ export {
|
|||||||
isIBMi,
|
isIBMi,
|
||||||
isLinuxPPCBE,
|
isLinuxPPCBE,
|
||||||
isSunOS,
|
isSunOS,
|
||||||
|
isDumbTerminal,
|
||||||
isFreeBSD,
|
isFreeBSD,
|
||||||
isOpenBSD,
|
isOpenBSD,
|
||||||
isLinux,
|
isLinux,
|
||||||
@ -76,6 +79,7 @@ export {
|
|||||||
mustCall,
|
mustCall,
|
||||||
mustCallAtLeast,
|
mustCallAtLeast,
|
||||||
hasMultiLocalhost,
|
hasMultiLocalhost,
|
||||||
|
skipIfDumbTerminal,
|
||||||
skipIfEslintMissing,
|
skipIfEslintMissing,
|
||||||
canCreateSymLink,
|
canCreateSymLink,
|
||||||
getCallSite,
|
getCallSite,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
const stdoutWrite = process.stdout.write;
|
const stdoutWrite = process.stdout.write;
|
||||||
@ -18,5 +18,7 @@ function doTest(isTTY, check) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fake TTY
|
// Fake TTY
|
||||||
|
if (!common.isDumbTerminal) {
|
||||||
doTest(true, check);
|
doTest(true, check);
|
||||||
|
}
|
||||||
doTest(false, '');
|
doTest(false, '');
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
// Flags: --expose-internals
|
// Flags: --expose-internals
|
||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const readline = require('readline');
|
const readline = require('readline');
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Flags: --expose-internals
|
// Flags: --expose-internals
|
||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const { internalBinding } = require('internal/test/binding');
|
const { internalBinding } = require('internal/test/binding');
|
||||||
const { PassThrough } = require('stream');
|
const { PassThrough } = require('stream');
|
||||||
const readline = require('readline');
|
const readline = require('readline');
|
||||||
@ -8,6 +8,8 @@ const assert = require('assert');
|
|||||||
|
|
||||||
const ctrlU = { ctrl: true, name: 'u' };
|
const ctrlU = { ctrl: true, name: 'u' };
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
{
|
{
|
||||||
const input = new PassThrough();
|
const input = new PassThrough();
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
|
@ -8,6 +8,8 @@ const assert = require('assert');
|
|||||||
const EventEmitter = require('events').EventEmitter;
|
const EventEmitter = require('events').EventEmitter;
|
||||||
const { getStringWidth } = require('internal/util/inspect');
|
const { getStringWidth } = require('internal/util/inspect');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
// This test verifies that the tab completion supports unicode and the writes
|
// This test verifies that the tab completion supports unicode and the writes
|
||||||
// are limited to the minimum.
|
// are limited to the minimum.
|
||||||
[
|
[
|
||||||
|
@ -5,6 +5,8 @@ const assert = require('assert');
|
|||||||
const PassThrough = require('stream').PassThrough;
|
const PassThrough = require('stream').PassThrough;
|
||||||
const readline = require('readline');
|
const readline = require('readline');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
// Checks that tab completion still works
|
// Checks that tab completion still works
|
||||||
// when output column size is undefined
|
// when output column size is undefined
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ const { PassThrough } = require('stream');
|
|||||||
const readline = require('readline');
|
const readline = require('readline');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
{
|
{
|
||||||
const input = new PassThrough();
|
const input = new PassThrough();
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const repl = require('repl');
|
const repl = require('repl');
|
||||||
const ArrayStream = require('../common/arraystream');
|
const ArrayStream = require('../common/arraystream');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
// \u001b[nG - Moves the cursor to n st column
|
// \u001b[nG - Moves the cursor to n st column
|
||||||
// \u001b[0J - Clear screen
|
// \u001b[0J - Clear screen
|
||||||
// \u001b[0K - Clear to line end
|
// \u001b[0K - Clear to line end
|
||||||
|
@ -10,6 +10,8 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { inspect } = require('util');
|
const { inspect } = require('util');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const ArrayStream = require('../common/arraystream');
|
const ArrayStream = require('../common/arraystream');
|
||||||
const fixtures = require('../common/fixtures');
|
const fixtures = require('../common/fixtures');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const repl = require('repl');
|
const repl = require('repl');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
const command = `.load ${fixtures.path('repl-load-multiline.js')}`;
|
const command = `.load ${fixtures.path('repl-load-multiline.js')}`;
|
||||||
const terminalCode = '\u001b[1G\u001b[0J \u001b[1G';
|
const terminalCode = '\u001b[1G\u001b[0J \u001b[1G';
|
||||||
const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g');
|
const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g');
|
||||||
|
@ -12,6 +12,8 @@ const path = require('path');
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ const { Stream } = require('stream');
|
|||||||
const { inspect } = require('util');
|
const { inspect } = require('util');
|
||||||
|
|
||||||
common.skipIfInspectorDisabled();
|
common.skipIfInspectorDisabled();
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
const PROMPT = 'repl > ';
|
const PROMPT = 'repl > ';
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ const path = require('path');
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
tmpdir.refresh();
|
tmpdir.refresh();
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { inspect } = require('util');
|
const { inspect } = require('util');
|
||||||
|
|
||||||
|
common.skipIfDumbTerminal();
|
||||||
common.allowGlobals('aaaa');
|
common.allowGlobals('aaaa');
|
||||||
|
|
||||||
const tmpdir = require('../common/tmpdir');
|
const tmpdir = require('../common/tmpdir');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user