MCPcopy Index your code
hub / github.com/coderoad/coderoad-vscode / onRunReset

Function onRunReset

src/actions/onRunReset.ts:15–41  ·  view source on GitHub ↗
(action: ResetAction, context: Context)

Source from the content-addressed store, hash-verified

13
14// reset to the start of the last test
15const onRunReset = async (action: ResetAction, context: Context): Promise<void> => {
16 // reset to timeline
17 const tutorial: TT.Tutorial | null = context.tutorial.get()
18 const position: T.Position = action.position ? action.position : context.position.get()
19
20 // get last pass commit
21 const hash: string = getCommitHashByPosition(position, tutorial)
22
23 const branch = tutorial?.config.repo.branch
24
25 if (!branch) {
26 logger('Error: No repo branch found for tutorial')
27 return
28 }
29
30 // load timeline until last pass commit
31 await reset({ branch, hash })
32
33 // if tutorial.config.reset.command, run it
34 const resetActions = tutorial?.config?.reset
35 if (resetActions) {
36 await hooks.onReset(
37 { commands: resetActions?.commands, vscodeCommands: resetActions?.vscodeCommands },
38 tutorial?.id as string,
39 )
40 }
41}
42
43export default onRunReset

Callers

nothing calls this directly

Calls 3

resetFunction · 0.85
onResetMethod · 0.65
loggerFunction · 0.50

Tested by

no test coverage detected