mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-02-01 17:36:51 +00:00
fix: improve test name escaping in TAP reporters (#1367)
This commit is contained in:
parent
cc17448c74
commit
f8db7d7346
@ -8,9 +8,10 @@ function yamlString(str: string): string {
|
||||
}
|
||||
|
||||
function tapString(str: string): string {
|
||||
// Test name cannot contain #
|
||||
// Test name cannot start with number
|
||||
return str.replace(/#/g, '?').replace(/^[0-9]+/, '?')
|
||||
return str
|
||||
.replace(/\\/g, '\\\\') // escape slashes
|
||||
.replace(/#/g, '\\#') // escape #
|
||||
.replace(/\n/g, ' ') // remove newlines
|
||||
}
|
||||
|
||||
export class TapReporter implements Reporter {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user