We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
2 parents17c6661 +5048f20 commitae2462bCopy full SHA for ae2462b
src/Channel.ts
@@ -22,7 +22,8 @@ class Channel implements Channel {
22
console.log('RECEIVED:',actionType)
23
switch(actionType){
24
case'TEST_RUN':
25
-vscode.commands.executeCommand('coderoad.run_test')
+
26
+vscode.commands.executeCommand('coderoad.run_test',action.payload)
27
return
28
case'TUTORIAL_CONFIG':
29
tutorialConfig(action.payload)
src/actions/runTest.ts
@@ -23,9 +23,10 @@ interface Props {
onSuccess():void
onFail():void
onRun():void
+onError():void
}
-asyncfunctionrunTest({onSuccess, onFail, onRun}:Props):Promise<void>{
+asyncfunctionrunTest({onSuccess, onFail, onRun, onError}:Props):Promise<void>{
30
// increment process id
31
constprocessId=++currentId
32
@@ -99,6 +100,7 @@ async function runTest({onSuccess, onFail, onRun}: Props): Promise<void> {
99
100
101
if(!stdout){
102
console.error('SOMETHING WENT WRONG WITH A PASSING TEST')
103
+onError()
104
105
// test runner failed
106
channel=getOutputChannel(outputChannelName)
src/editor/commands.ts
@@ -52,22 +52,26 @@ export const createCommands = ({vscodeExt}: CreateCommandProps) => {
52
53
webview.createOrShow(column)
54
},
55
-[COMMANDS.RUN_TEST]:()=>{
+[COMMANDS.RUN_TEST]:({stepId}:{stepId:string})=>{
56
console.log('run test webview',Object.keys(webview))
57
runTest({
58
onSuccess:()=>{
59
console.log('COMMAND TEST_PASS')
60
-webview.send({type:'TEST_PASS'})
+webview.send({type:'TEST_PASS',payload:{stepId}})
61
vscode.window.showInformationMessage('PASS')
62
63
onFail:()=>{
64
console.log('COMMAND TEST_FAIL')
65
-webview.send({type:'TEST_FAIL'})
+webview.send({type:'TEST_FAIL',payload:{stepId}})
66
vscode.window.showWarningMessage('FAIL')
67
68
+onError:()=>{
69
+console.log('COMMAND TEST_ERROR')
70
+webview.send({type:'TEST_ERROR',payload:[stepId]})
71
+},
72
onRun:()=>{
73
console.log('COMMAND TEST_RUN')
-webview.send({type:'TEST_RUN'})
74
+webview.send({type:'TEST_RUN',payload:{stepId}})
75
76
})
77
web-app/src/services/channel/index.ts
@@ -25,7 +25,6 @@ class Channel {
this.machineSend=send
publicreceive=(event:ReceivedEvent)=>{
-console.log('CLIENT RECEIVE')
constaction=event.data
//@ts-ignore // ignore browser events from plugins
@@ -41,16 +40,20 @@ class Channel {
41
40
case'TEST_PASS':
42
// { type: 'TEST_PASS', payload: { stepId: string }}
43
this.machineSend(action)
44
-console.log('test passed')
45
46
case'TEST_FAIL':
47
48
49
50
console.log('TEST_RUN')
+this.machineSend(action)
+return
51
+case'TEST_ERROR':
+console.log('TEST_ERROR')
case'ACTIONS_LOADED':
-console.log('ACTIONS_LOADED')
+// TODO: use this for verifying completion of stepActions
default:
if(action.type){
web-app/src/services/state/actions/context.ts
@@ -104,13 +104,10 @@ export default {
//@ts-ignore
updateStepProgress:assign({
progress:(context:CR.MachineContext,event:CR.MachineEvent):CR.Progress=>{
107
-
108
// update progress by tracking completed
109
constcurrentProgress:CR.Progress=context.progress
110
111
-// TODO: should use event id, to verify not multiple successes jumping one
112
-// const stepId = event.payload.stepId
113
-const{stepId}=context.position
+const{stepId}=event.payload
114
115
currentProgress.steps[stepId]=true
116
web-app/src/services/state/machine.ts
@@ -124,6 +124,7 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
124
actions:['updateStepProgress']
125
126
TEST_FAIL:'TestFail',
127
+TEST_ERROR:'Normal'
128
129
130
TestPass:{