@inquirer/testing 3.3.11 → 3.3.13

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -1
  2. 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
- const answer = prompt(config, { ...options, input, output });
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.11",
3
+ "version": "3.3.13",
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": "^4.1.0",
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": "51ac389603405e8f9f315ce49416153d95c5fefe"
171
+ "gitHead": "cbdb34bfc6c245941d80ef88493c50b3d6dbfce6"
172
172
  }