test: fix invalid output TAP if there newline in test name
fixes: #45396 (closed)
fix test outputs invalid TAP if there is a newline in the test name
Fixed Changes
Test Case:
// test.mjs
import { it } from 'node:test'
it('Hello \n world \t hello \b hello \v hello \f hello \r hello', () => {});
Output
TAP version 13
# Subtest: Hello \n world \t hello \b hello \v hello \f hello \r hello
ok 1 - Hello \n world \t hello \b hello \v hello \f hello \r hello
---
duration_ms: 1.117041
...
1..1
# tests 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 6.629375