Skip to content

Commit ccacd8e

Browse files
Fix tests
1 parent 82cf498 commit ccacd8e

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/theme/src/cli/utilities/repl/repl.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {DevServerSession} from '../theme-environment/types.js'
55
import {describe, expect, test, vi} from 'vitest'
66
import {outputInfo} from '@shopify/cli-kit/node/output'
77

8-
import {createInterface} from 'readline'
8+
import {Interface} from 'readline'
99

1010
vi.mock('@shopify/cli-kit/node/output')
1111
vi.mock('./evaluator.js')
@@ -21,10 +21,15 @@ describe('handleInput', () => {
2121
}
2222
const themeId = '123'
2323
const url = '/'
24-
const rl = createInterface({
25-
input: process.stdin,
26-
output: process.stdout,
27-
})
24+
// Use a stub Interface instead of a real readline created from process.stdin.
25+
// In Node 26, readline.createInterface on a non-TTY stdin that is already
26+
// at EOF (as in Vitest workers) immediately closes the Interface, and
27+
// calling `prompt()` on a closed Interface throws `Error: readline was
28+
// closed` (it was a silent no-op in Node 22/24).
29+
const rl = {
30+
prompt: vi.fn(),
31+
close: vi.fn(),
32+
} as unknown as Interface
2833

2934
test('should call outputInfo if input has {{ delimiter', async () => {
3035
// Given

0 commit comments

Comments
 (0)