diff --git a/lib/internal/test_runner/reporter/tap.js b/lib/internal/test_runner/reporter/tap.js index ebf7be80e2a2f5..20514a88e1741a 100644 --- a/lib/internal/test_runner/reporter/tap.js +++ b/lib/internal/test_runner/reporter/tap.js @@ -132,14 +132,14 @@ function indent(nesting) { // In certain places, # and \ need to be escaped as \# and \\. function tapEscape(input) { - let result = StringPrototypeReplaceAll(input, '\\', '\\\\'); - result = StringPrototypeReplaceAll(result, '#', '\\#'); - result = StringPrototypeReplaceAll(result, '\b', '\\b'); + let result = StringPrototypeReplaceAll(input, '\b', '\\b'); result = StringPrototypeReplaceAll(result, '\f', '\\f'); result = StringPrototypeReplaceAll(result, '\t', '\\t'); result = StringPrototypeReplaceAll(result, '\n', '\\n'); result = StringPrototypeReplaceAll(result, '\r', '\\r'); result = StringPrototypeReplaceAll(result, '\v', '\\v'); + result = StringPrototypeReplaceAll(result, '\\', '\\\\'); + result = StringPrototypeReplaceAll(result, '#', '\\#'); return result; } diff --git a/test/message/test_runner_output.out b/test/message/test_runner_output.out index 42eae979daf6dd..15d2009816a961 100644 --- a/test/message/test_runner_output.out +++ b/test/message/test_runner_output.out @@ -346,8 +346,8 @@ ok 36 - functionAndOptions # SKIP --- duration_ms: * ... -# Subtest: escaped description \\ \# \\\#\\ \n \t \f \v \b \r -ok 37 - escaped description \\ \# \\\#\\ \n \t \f \v \b \r +# Subtest: escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r +ok 37 - escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r --- duration_ms: * ... diff --git a/test/message/test_runner_output_cli.out b/test/message/test_runner_output_cli.out index 044610905755ca..a8e2f2c5b586f4 100644 --- a/test/message/test_runner_output_cli.out +++ b/test/message/test_runner_output_cli.out @@ -122,9 +122,9 @@ TAP version 13 failureType: 'testCodeFailure' error: |- Expected values to be strictly equal: - + true !== false - + code: 'ERR_ASSERTION' expected: false actual: true @@ -345,8 +345,8 @@ TAP version 13 --- duration_ms: * ... - # Subtest: escaped description \\ \# \\\#\\ n \\t f \\v b \\r - ok 37 - escaped description \\ \# \\\#\\ n \\t f \\v b \\r + # Subtest: escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r + ok 37 - escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r --- duration_ms: * ...