From 6699359c7c15b92256c1c3c9813bd50f05a5606f Mon Sep 17 00:00:00 2001 From: Theodor Steiner Date: Wed, 1 Mar 2023 11:49:30 +0900 Subject: [PATCH] test: fix test failing due to difference in terminal codes --- test/parallel/test-repl-load-multiline.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-repl-load-multiline.js b/test/parallel/test-repl-load-multiline.js index 4fcf206bef1be1..092f049ab00a31 100644 --- a/test/parallel/test-repl-load-multiline.js +++ b/test/parallel/test-repl-load-multiline.js @@ -8,8 +8,11 @@ const repl = require('repl'); common.skipIfDumbTerminal(); const command = `.load ${fixtures.path('repl-load-multiline.js')}`; -const terminalCode = '\u001b[1G\u001b[0J \u001b[1G'; -const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g'); + +// \u001b[nG - Move the cursor to nth column. +// \u001b[0J - Clear from cursor to end of screen. +/* eslint-disable-next-line no-control-regex */ +const terminalCodeRegex = /(\u001b\[0J|\u001b\[\d+G) ?/g; const expected = `${command} const getLunch = () =>