Skip to content

Commit 95e13f2

Browse files
committed
try to make the interactive test less flaky
It seems like it's not getting the last item sometimes, because the readline doesn't see it in time, or something. Just keep repeating the last entry if it asks again.
1 parent 38e731f commit 95e13f2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/bin.js

+5
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,18 @@ t.test('interactive deletes', t => {
339339
}, 10000)
340340
child.stdout.setEncoding('utf8')
341341
child.stderr.setEncoding('utf8')
342+
let last = ''
342343
child.stdout.on('data', async c => {
343344
await new Promise(r => setTimeout(r, 50))
344345
out.push(c.trim())
345346
const s = script.shift()
346347
if (s !== undefined) {
348+
last === s
347349
out.push(s.trim())
348350
child.stdin.write(s + '\n')
351+
} else {
352+
// keep writing whatever the last option was
353+
child.stdin.write(last + '\n')
349354
}
350355
})
351356
child.stderr.on('data', c => {

0 commit comments

Comments
 (0)