fix(tstest): preserve streaming console output and correctly buffer incomplete TAP lines

This commit is contained in:
2026-01-19 19:14:05 +00:00
parent ae59b7adf2
commit 46f0a5a8cf
8 changed files with 202 additions and 109 deletions

View File

@@ -10,7 +10,7 @@ export class TapTestResult {
constructor(public id: number) {}
/**
* adds a logLine to the log buffer of the test
* adds a logLine to the log buffer of the test (with newline appended)
* @param logLine
*/
addLogLine(logLine: string) {
@@ -19,6 +19,15 @@ export class TapTestResult {
this.testLogBuffer = Buffer.concat([this.testLogBuffer, logLineBuffer]);
}
/**
* adds raw text to the log buffer without appending newline (for streaming output)
* @param text
*/
addLogLineRaw(text: string) {
const logLineBuffer = Buffer.from(text);
this.testLogBuffer = Buffer.concat([this.testLogBuffer, logLineBuffer]);
}
setTestResult(testOkArg: boolean) {
this.testOk = testOkArg;
this.testSettled = true;