| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,7 +119,7 @@ class SpecReporter extends Transform { | |||
| 119 | 119 | break; | |
| 120 | 120 | case 'test:stderr': | |
| 121 | 121 | case 'test:stdout': | |
| 122 | - return `${data.message}\n`; | ||
| 122 | + return data.message; | ||
| 123 | 123 | case 'test:diagnostic': | |
| 124 | 124 | return `${colors[type]}${this.#indent(data.nesting)}${symbols[type]}${data.message}${white}\n`; | |
| 125 | 125 | case 'test:coverage': | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,10 +5,10 @@ const { | |||
| 5 | 5 | ArrayPrototypePush, | |
| 6 | 6 | ObjectEntries, | |
| 7 | 7 | RegExpPrototypeSymbolReplace, | |
| 8 | + RegExpPrototypeSymbolSplit, | ||
| 8 | 9 | SafeMap, | |
| 9 | 10 | SafeSet, | |
| 10 | 11 | StringPrototypeReplaceAll, | |
| 11 | - StringPrototypeSplit, | ||
| 12 | 12 | StringPrototypeRepeat, | |
| 13 | 13 | } = primordials; | |
| 14 | 14 | const { inspectWithNoCustomRetry } = require('internal/errors'); | |
@@ -46,8 +46,14 @@ async function * tapReporter(source) { | |||
| 46 | 46 | yield `${indent(data.nesting)}# Subtest: ${tapEscape(data.name)}\n`; | |
| 47 | 47 | break; | |
| 48 | 48 | case 'test:stderr': | |
| 49 | - case 'test:stdout': | ||
| 50 | - case 'test:diagnostic': | ||
| 49 | + case 'test:stdout': { | ||
| 50 | + const lines = RegExpPrototypeSymbolSplit(kLineBreakRegExp, data.message); | ||
| 51 | + for (let i = 0; i < lines.length; i++) { | ||
| 52 | + if (lines[i].length === 0) continue; | ||
| 53 | + yield `# ${tapEscape(lines[i])}\n`; | ||
| 54 | + } | ||
| 55 | + break; | ||
| 56 | + } case 'test:diagnostic': | ||
| 51 | 57 | yield `${indent(data.nesting)}# ${tapEscape(data.message)}\n`; | |
| 52 | 58 | break; | |
| 53 | 59 | case 'test:coverage': | |
@@ -124,7 +130,7 @@ function jsToYaml(indent, name, value, seen) { | |||
| 124 | 130 | return `${prefix}${inspectWithNoCustomRetry(value, inspectOptions)}\n`; | |
| 125 | 131 | } | |
| 126 | 132 | ||
| 127 | - const lines = StringPrototypeSplit(value, kLineBreakRegExp); | ||
| 133 | + const lines = RegExpPrototypeSymbolSplit(kLineBreakRegExp, value); | ||
| 128 | 134 | ||
| 129 | 135 | if (lines.length === 1) { | |
| 130 | 136 | return `${prefix}${inspectWithNoCustomRetry(value, inspectOptions)}\n`; | |
@@ -224,7 +230,7 @@ function jsToYaml(indent, name, value, seen) { | |||
| 224 | 230 | const frames = []; | |
| 225 | 231 | ||
| 226 | 232 | ArrayPrototypeForEach( | |
| 227 | - StringPrototypeSplit(errStack, kLineBreakRegExp), | ||
| 233 | + RegExpPrototypeSymbolSplit(kLineBreakRegExp, errStack), | ||
| 228 | 234 | (frame) => { | |
| 229 | 235 | const processed = RegExpPrototypeSymbolReplace( | |
| 230 | 236 | kFrameStartRegExp, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,14 +11,12 @@ const { | |||
| 11 | 11 | ArrayPrototypeSlice, | |
| 12 | 12 | ArrayPrototypeSome, | |
| 13 | 13 | ArrayPrototypeSort, | |
| 14 | - hardenRegExp, | ||
| 15 | 14 | ObjectAssign, | |
| 16 | 15 | PromisePrototypeThen, | |
| 17 | 16 | SafePromiseAll, | |
| 18 | 17 | SafePromiseAllReturnVoid, | |
| 19 | 18 | SafePromiseAllSettledReturnVoid, | |
| 20 | 19 | PromiseResolve, | |
| 21 | - RegExpPrototypeSymbolSplit, | ||
| 22 | 20 | SafeMap, | |
| 23 | 21 | SafeSet, | |
| 24 | 22 | StringPrototypeIndexOf, | |
@@ -75,7 +73,6 @@ const { | |||
| 75 | 73 | const kFilterArgs = ['--test', '--experimental-test-coverage', '--watch']; | |
| 76 | 74 | const kFilterArgValues = ['--test-reporter', '--test-reporter-destination']; | |
| 77 | 75 | const kDiagnosticsFilterArgs = ['tests', 'suites', 'pass', 'fail', 'cancelled', 'skipped', 'todo', 'duration_ms']; | |
| 78 | - const kSplitLine = hardenRegExp(/\r?\n/); | ||
| 79 | 76 | ||
| 80 | 77 | const kCanceledTests = new SafeSet() | |
| 81 | 78 | .add(kCancelledByParent).add(kAborted).add(kTestTimeoutFailure); | |
@@ -301,15 +298,11 @@ class FileTest extends Test { | |||
| 301 | 298 | } | |
| 302 | 299 | ||
| 303 | 300 | if (TypedArrayPrototypeGetLength(nonSerialized) > 0) { | |
| 304 | - const messages = RegExpPrototypeSymbolSplit(kSplitLine, nonSerialized.toString('utf-8')); | ||
| 305 | - for (let i = 0; i < messages.length; i++) { | ||
| 306 | - const message = messages[i]; | ||
| 307 | - this.addToReport({ | ||
| 308 | - __proto__: null, | ||
| 309 | - type: 'test:stdout', | ||
| 310 | - data: { __proto__: null, file: this.name, message }, | ||
| 311 | - }); | ||
| 312 | - } | ||
| 301 | + this.addToReport({ | ||
| 302 | + __proto__: null, | ||
| 303 | + type: 'test:stdout', | ||
| 304 | + data: { __proto__: null, file: this.name, message: nonSerialized.toString('utf-8') }, | ||
| 305 | + }); | ||
| 313 | 306 | } | |
| 314 | 307 | ||
| 315 | 308 | while (bufferHead?.length >= kSerializedSizeHeader) { | |
@@ -383,7 +376,7 @@ function runTestFile(path, root, inspectPort, filesWatcher, testNamePatterns) { | |||
| 383 | 376 | subtest.addToReport({ | |
| 384 | 377 | __proto__: null, | |
| 385 | 378 | type: 'test:stderr', | |
| 386 | - data: { __proto__: null, file: path, message: line }, | ||
| 379 | + data: { __proto__: null, file: path, message: line + '\n' }, | ||
| 387 | 380 | }); | |
| 388 | 381 | }); | |
| 389 | 382 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments