From 95e13f2d78b43d97166fe2e1cb156445cc38f121 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 3 Mar 2023 17:15:12 -0800 Subject: [PATCH] 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. --- test/bin.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/bin.js b/test/bin.js index f3ef86e3..aa0f5513 100644 --- a/test/bin.js +++ b/test/bin.js @@ -339,13 +339,18 @@ t.test('interactive deletes', t => { }, 10000) child.stdout.setEncoding('utf8') child.stderr.setEncoding('utf8') + let last = '' child.stdout.on('data', async c => { await new Promise(r => setTimeout(r, 50)) out.push(c.trim()) const s = script.shift() if (s !== undefined) { + last === s out.push(s.trim()) child.stdin.write(s + '\n') + } else { + // keep writing whatever the last option was + child.stdin.write(last + '\n') } }) child.stderr.on('data', c => {