GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix invalid output TAP if there newline in test name · nodejs/node@38fb2c1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/test_runner
    • tap_stream.js
  • test/message
    • test_runner_output.js
    • test_runner_output.out
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/test_runner/tap_stream.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/tap_stream.js
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,15 @@ class TapStream extends Readable {
131131

132132
// In certain places, # and \ need to be escaped as \# and \\.
133133
function tapEscape(input) {
134-
return StringPrototypeReplaceAll(
135-
StringPrototypeReplaceAll(input, '\\', '\\\\'), '#', '\\#'
136-
);
134+
let result = StringPrototypeReplaceAll(input, '\\', '\\\\');
135+
result = StringPrototypeReplaceAll(result, '#', '\\#');
136+
result = StringPrototypeReplaceAll(result, '\b', '\\b');
137+
result = StringPrototypeReplaceAll(result, '\f', '\\f');
138+
result = StringPrototypeReplaceAll(result, '\t', '\\t');
139+
result = StringPrototypeReplaceAll(result, '\n', '\\n');
140+
result = StringPrototypeReplaceAll(result, '\r', '\\r');
141+
result = StringPrototypeReplaceAll(result, '\v', '\\v');
142+
return result;
137143
}
138144

139145
function jsToYaml(indent, name, value) {
Collapse file

‎test/message/test_runner_output.js‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ test('test with a name and options provided', { skip: true });
213213
test({ skip: true }, function functionAndOptions() {});
214214

215215
// A test whose description needs to be escaped.
216-
test('escaped description \\ # \\#\\');
216+
test('escaped description \\ # \\#\\ \n \t \f \v \b \r');
217217

218218
// A test whose skip message needs to be escaped.
219219
test('escaped skip message', { skip: '#skip' });
Collapse file

‎test/message/test_runner_output.out‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output.out
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ not ok 13 - async assertion fail
127127
failureType: 'testCodeFailure'
128128
error: |-
129129
Expected values to be strictly equal:
130-
130+
131131
true !== false
132-
132+
133133
code: 'ERR_ASSERTION'
134134
expected: false
135135
actual: true
@@ -353,8 +353,8 @@ ok 36 - functionAndOptions # SKIP
353353
---
354354
duration_ms: *
355355
...
356-
# Subtest: escaped description \\ \# \\\#\\
357-
ok 37 - escaped description \\ \# \\\#\\
356+
# Subtest: escaped description \\ \# \\\#\\ \n \t \f \v \b \r
357+
ok 37 - escaped description \\ \# \\\#\\ \n \t \f \v \b \r
358358
---
359359
duration_ms: *
360360
...

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.