diff --git a/test/parallel/test-repl-preview-newlines.js b/test/parallel/test-repl-preview-newlines.js index b607faa2fd6c46..a0055b46fe2c2c 100644 --- a/test/parallel/test-repl-preview-newlines.js +++ b/test/parallel/test-repl-preview-newlines.js @@ -20,12 +20,10 @@ repl.start({ let output = ''; outputStream.write = (chunk) => output += chunk; -const testChars = ['\\n', '\\v', '\\r']; - -for (const test of testChars) { - inputStream.emit('data', `"${test}"()`); +for (const testChar of '\n\v\r') { + inputStream.emit('data', `${JSON.stringify(testChar)}()`); // Make sure the output is on a single line - assert.strictEqual(output, `"${test}"()\n\x1B[90mTypeError: "\x1B[39m\x1B[9G\x1B[1A`); + assert.strictEqual(output, `${JSON.stringify(testChar)}()\n\x1B[90mTypeError: "\x1B[39m\x1B[9G\x1B[1A`); inputStream.run(['']); output = ''; }