Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
012acb0
feat: verbous error when entire test tree is canceled
MoLow Aug 2, 2022
d885ee2
feat: support programmatically running `--test`
MoLow Aug 15, 2022
27241c3
fix: fix `duration_ms` to be milliseconds
MoLow Sep 4, 2022
6755536
feat: support using `--inspect` with `--test`
MoLow Sep 10, 2022
c50f844
fix: include stack of uncaught exceptions
MoLow Sep 14, 2022
1950b38
test: fix test-runner-inspect
MoLow Sep 14, 2022
c5fd64c
feat: add --test-name-pattern CLI flag
cjihrig Sep 1, 2022
46dce07
feat: add extra fields in AssertionError YAML
bengl Oct 26, 2022
0bfdb77
fix: call {before,after}Each() on suites
cjihrig Oct 27, 2022
08269c5
fix: report tap subtest in order
MoLow Oct 28, 2022
f2815af
fix: fix afterEach not running on test failures
MrJithil Nov 7, 2022
cff397a
fix: avoid swallowing of asynchronously thrown errors
fossamagna Nov 7, 2022
2e499ee
feat: support function mocking
cjihrig Apr 4, 2022
5f8ce61
feat: add initial TAP parser
manekinekko Nov 21, 2022
5ba2500
fix: remove stdout and stderr from error
cjihrig Nov 25, 2022
b942f93
feat: add getter and setter to MockTracker
fossamagna Nov 18, 2022
b3b384e
fix: don't use a symbol for runHook()
cjihrig Dec 6, 2022
71b659e
feat: add t.after() hook
cjihrig Dec 8, 2022
c0854ac
test: fix invalid output TAP if there newline in test name
pulkit-30 Dec 11, 2022
9b49978
chore: refactor `tap_parser` to use more primordials
aduh95 Dec 11, 2022
4e778bc
chore: refactor `tap_lexer` to use more primordials
aduh95 Dec 12, 2022
d1343a7
feat: parse yaml
MoLow Dec 13, 2022
c80e426
fix: run t.after() if test body throws
cjihrig Dec 17, 2022
9fa496b
test: fix mock.method to support class instances
ErickWendel Dec 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: fix invalid output TAP if there newline in test name
PR-URL: nodejs/node#45742
Fixes: nodejs/node#45396
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
(cherry picked from commit 22dc987fde29734c5bcbb7c33da20d184ff61627)
  • Loading branch information
pulkit-30 authored and MoLow committed Feb 2, 2023
commit c0854ac037d0e9a1c54f91b6faf4ff35f0b2a96a
14 changes: 10 additions & 4 deletions lib/internal/test_runner/tap_stream.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/nodejs/node/blob/f8ce9117b19702487eb600493d941f7876e00e01/lib/internal/test_runner/tap_stream.js
// https://github.com/nodejs/node/blob/22dc987fde29734c5bcbb7c33da20d184ff61627/lib/internal/test_runner/tap_stream.js

'use strict'

Expand Down Expand Up @@ -134,9 +134,15 @@ class TapStream extends Readable {

// In certain places, # and \ need to be escaped as \# and \\.
function tapEscape (input) {
return StringPrototypeReplaceAll(
StringPrototypeReplaceAll(input, '\\', '\\\\'), '#', '\\#'
)
let result = StringPrototypeReplaceAll(input, '\\', '\\\\')
result = StringPrototypeReplaceAll(result, '#', '\\#')
result = StringPrototypeReplaceAll(result, '\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')
return result
}

function jsToYaml (indent, name, value) {
Expand Down
4 changes: 2 additions & 2 deletions test/message/test_runner_output.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/nodejs/node/blob/cb7e0c59df10a42cd6930ca7f99d3acee1ce7627/test/message/test_runner_output.js
// https://github.com/nodejs/node/blob/22dc987fde29734c5bcbb7c33da20d184ff61627/test/message/test_runner_output.js
// Flags: --no-warnings
'use strict'
require('../common')
Expand Down Expand Up @@ -214,7 +214,7 @@ test('test with a name and options provided', { skip: true })
test({ skip: true }, function functionAndOptions () {})

// A test whose description needs to be escaped.
test('escaped description \\ # \\#\\')
test('escaped description \\ # \\#\\ \n \t \f \v \b \r')

// A test whose skip message needs to be escaped.
test('escaped skip message', { skip: '#skip' })
Expand Down
8 changes: 4 additions & 4 deletions test/message/test_runner_output.out
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ not ok 13 - async assertion fail
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly equal:

true !== false

code: 'ERR_ASSERTION'
expected: false
actual: true
Expand Down Expand Up @@ -353,8 +353,8 @@ ok 36 - functionAndOptions # SKIP
---
duration_ms: *
...
# Subtest: escaped description \\ \# \\\#\\
ok 37 - escaped description \\ \# \\\#\\
# Subtest: escaped description \\ \# \\\#\\ \n \t \f \v \b \r
ok 37 - escaped description \\ \# \\\#\\ \n \t \f \v \b \r
---
duration_ms: *
...
Expand Down