RoadmapShopEvents
Skip to main content

Home > @rushstack/terminal > MockWritable

MockWritable class

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

A TerminalWritable subclass for use by unit tests.

Signature:

export declare class MockWritable extends TerminalWritable 

Extends: TerminalWritable

Constructors

ConstructorModifiersDescription
(constructor)(options)

Constructs a new instance of the TerminalWritable class

(Inherited from TerminalWritable)

Properties

PropertyModifiersTypeDescription
chunksreadonlyITerminalChunk[](BETA)
isOpenreadonlyboolean

This property is initially true when the object is constructed, and becomes false when close() is called.

(Inherited from TerminalWritable)

preventAutoclosereadonlyboolean(Inherited from TerminalWritable)

Methods

MethodModifiersDescription
close()

Calling this method flushes any remaining outputs and permanently transitions the TerminalWritable to a "closed" state, where no further chunks can be written.

(Inherited from TerminalWritable)

getAllOutput()(BETA)
getFormattedChunks()(BETA)
onClose()protected

Subclasses can override this empty method to perform additional operations such as closing a file handle.

(Inherited from TerminalWritable)

onWriteChunk(chunk)protected(BETA)
reset()(BETA)
writeChunk(chunk)

Upstream objects call this method to provide inputs to this object.

(Inherited from TerminalWritable)