MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / tryCommand

Function tryCommand

plugin/tests/watch.test.ts:348–361  ·  view source on GitHub ↗
(command: string)

Source from the content-addressed store, hash-verified

346 const opts: Opts = { armed: false }
347 const s = stubs(on, opts)
348 const tryCommand = async (command: string) => {
349 opts.armed = false
350 await $.session.start({ cwd: '/work/demo' })
351 await usePad($, 'pad bootstrap') // the first use: not armed
352 opts.armed = true // consent exists by the time the command returns
353 await usePad($, command)
354 await settle()
355 const started = s.spawns.length
356 // an end that stops the stream resets wake and the stream
357 await $.session.end({ reason: 'prompt_input_exit' })
358 s.spawns.length = 0
359 s.runs.length = 0
360 return [command, started]
361 }
362 for (const command of ARMS) expect(await tryCommand(command)).toEqual([command, 1])
363 for (const command of NOT_ARMS) expect(await tryCommand(command)).toEqual([command, 0])
364})

Callers 1

watch.test.tsFile · 0.85

Calls 4

endMethod · 0.80
usePadFunction · 0.70
settleFunction · 0.70
startMethod · 0.45

Tested by

no test coverage detected