@pumpkin-plugins/test-harness API / log-buffer / LogBuffer
Class: LogBuffer
Defined in: log-buffer.ts:16
Collects a process's output line by line, without color codes, and lets tests wait for a line.
Properties
lines
readonlylines:string[] =[]
Defined in: log-buffer.ts:18
Every non-blank line seen so far.
Methods
attach()
attach(
stream):void
Defined in: log-buffer.ts:25
Starts collecting a stream.
Parameters
stream
ReadableStream
A process's stdout or stderr.
Returns
void
notify()
notify():
void
Defined in: log-buffer.ts:41
Wakes everything that is waiting so it can look again. Call when the process state changes.
Returns
void
tail()
tail(
count?):string
Defined in: log-buffer.ts:80
The last lines of output.
Parameters
count?
number = 40
How many lines.
Returns
string
A block of text for error messages.
text()
text():
string
Defined in: log-buffer.ts:88
All output.
Returns
string
Every line joined with newlines.
waitFor()
waitFor(
pattern,options):Promise<string>
Defined in: log-buffer.ts:54
Waits for a line to match.
Parameters
pattern
RegExp
What to look for.
options
When to give up.
Returns
Promise<string>
The first matching line.
Throws
When the process ends or the time runs out first, with the last output attached.