@pumpkin-plugins/test-harness API / instance / PumpkinInstance
Class: PumpkinInstance
Defined in: instance.ts:36
A running Pumpkin server in a temporary directory. Start one with startPumpkin.
Accessors
bedrockPort
Get Signature
get bedrockPort():
number
Defined in: instance.ts:99
The port the Bedrock edition listens on.
Returns
number
dir
Get Signature
get dir():
string
Defined in: instance.ts:89
The server's temporary directory.
Returns
string
javaPort
Get Signature
get javaPort():
number
Defined in: instance.ts:94
The port the Java edition listens on.
Returns
number
lines
Get Signature
get lines():
string[]
Defined in: instance.ts:104
Every log line so far, without color codes.
Returns
string[]
Methods
command()
command(
text):void
Defined in: instance.ts:149
Runs a console command.
Parameters
text
string
The command, for example list.
Returns
void
errors()
errors():
string[]
Defined in: instance.ts:129
ERROR log lines, minus the known first-start baseline.
Returns
string[]
The lines.
logs()
logs():
string
Defined in: instance.ts:121
All log output.
Returns
string
Every line joined with newlines.
pluginDataDir()
pluginDataDir(
pluginName):string
Defined in: instance.ts:113
Where Pumpkin keeps a plugin's private data.
Parameters
pluginName
string
The plugin's name.
Returns
string
The folder on disk.
stop()
stop():
Promise<void>
Defined in: instance.ts:154
Stops the server (console stop, then SIGKILL after 20 s) and removes its directory.
Returns
Promise<void>
waitForLog()
waitForLog(
pattern,timeoutMs?,fromIndex?):Promise<string>
Defined in: instance.ts:141
Waits for a log line.
Parameters
pattern
RegExp
What to look for.
timeoutMs?
number = 30_000
How long to wait.
fromIndex?
number = 0
Only consider lines from this index on, to ignore earlier output.
Returns
Promise<string>
The first matching line.
Throws
When the server exits or the time runs out first.
start()
staticstart(options?):Promise<PumpkinInstance>
Defined in: instance.ts:66
Starts a server and waits until it is running.
Parameters
options?
StartOptions = {}
What to put in its directory and how to name its log.
Returns
Promise<PumpkinInstance>
The running server.
Throws
When it doesn't start in time, or keeps losing its port to another process. The server is stopped first.