@inquirer/testing 3.3.10 → 3.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +18 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7,7 +7,24 @@ export async function render(prompt, config, options) {
|
|
|
7
7
|
input.unmute();
|
|
8
8
|
const output = new BufferedStream();
|
|
9
9
|
const firstRender = new Promise((resolve) => output.once('render', resolve));
|
|
10
|
-
|
|
10
|
+
// Node's readline disables line editing (backspace, arrows, etc.) when
|
|
11
|
+
// `TERM=dumb` is set, regardless of whether the input is a real terminal.
|
|
12
|
+
// Environments like GitLab CI or Emacs shells set `TERM=dumb`, which would
|
|
13
|
+
// silently break the keypress simulation below. The check only happens when
|
|
14
|
+
// the readline interface is created (synchronously inside `prompt()`), so
|
|
15
|
+
// overriding `TERM` for the prompt construction alone is sufficient.
|
|
16
|
+
// @see https://github.com/SBoudrias/Inquirer.js/issues/2180
|
|
17
|
+
const savedTerm = process.env['TERM'];
|
|
18
|
+
if (savedTerm === 'dumb')
|
|
19
|
+
process.env['TERM'] = 'xterm-256color';
|
|
20
|
+
let answer;
|
|
21
|
+
try {
|
|
22
|
+
answer = prompt(config, { ...options, input, output });
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
if (savedTerm === 'dumb')
|
|
26
|
+
process.env['TERM'] = 'dumb';
|
|
27
|
+
}
|
|
11
28
|
// The first render is synchronous. If our BufferedStream received a write, we're ready.
|
|
12
29
|
if (output.writeCount === 0) {
|
|
13
30
|
// Our BufferedStream didn't receive a write yet. This happens when the prompt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/testing",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.12",
|
|
4
4
|
"description": "Inquirer testing utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"tsc": "tsc"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@inquirer/type": "
|
|
86
|
+
"@inquirer/type": "4.1.1",
|
|
87
87
|
"@xterm/headless": "^6.0.0",
|
|
88
88
|
"mute-stream": "^3.0.0"
|
|
89
89
|
},
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
},
|
|
169
169
|
"main": "./dist/index.js",
|
|
170
170
|
"types": "./dist/index.d.ts",
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "5748bd9966b5e175ddf5995ee4cdce6f60c4272e"
|
|
172
172
|
}
|