Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae2462b

Browse files
authored
Merge pull request#30 from ShMcK/feature/control-test-commit
Feature/control test commit
2 parents17c6661 +5048f20 commitae2462b

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

‎src/Channel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class Channel implements Channel {
2222
console.log('RECEIVED:',actionType)
2323
switch(actionType){
2424
case'TEST_RUN':
25-
vscode.commands.executeCommand('coderoad.run_test')
25+
26+
vscode.commands.executeCommand('coderoad.run_test',action.payload)
2627
return
2728
case'TUTORIAL_CONFIG':
2829
tutorialConfig(action.payload)

‎src/actions/runTest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ interface Props {
2323
onSuccess():void
2424
onFail():void
2525
onRun():void
26+
onError():void
2627
}
2728

28-
asyncfunctionrunTest({onSuccess, onFail, onRun}:Props):Promise<void>{
29+
asyncfunctionrunTest({onSuccess, onFail, onRun, onError}:Props):Promise<void>{
2930
// increment process id
3031
constprocessId=++currentId
3132

@@ -99,6 +100,7 @@ async function runTest({onSuccess, onFail, onRun}: Props): Promise<void> {
99100

100101
if(!stdout){
101102
console.error('SOMETHING WENT WRONG WITH A PASSING TEST')
103+
onError()
102104
}
103105
// test runner failed
104106
channel=getOutputChannel(outputChannelName)

‎src/editor/commands.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,26 @@ export const createCommands = ({vscodeExt}: CreateCommandProps) => {
5252

5353
webview.createOrShow(column)
5454
},
55-
[COMMANDS.RUN_TEST]:()=>{
55+
[COMMANDS.RUN_TEST]:({stepId}:{stepId:string})=>{
5656
console.log('run test webview',Object.keys(webview))
5757
runTest({
5858
onSuccess:()=>{
5959
console.log('COMMAND TEST_PASS')
60-
webview.send({type:'TEST_PASS'})
60+
webview.send({type:'TEST_PASS',payload:{stepId}})
6161
vscode.window.showInformationMessage('PASS')
6262
},
6363
onFail:()=>{
6464
console.log('COMMAND TEST_FAIL')
65-
webview.send({type:'TEST_FAIL'})
65+
webview.send({type:'TEST_FAIL',payload:{stepId}})
6666
vscode.window.showWarningMessage('FAIL')
6767
},
68+
onError:()=>{
69+
console.log('COMMAND TEST_ERROR')
70+
webview.send({type:'TEST_ERROR',payload:[stepId]})
71+
},
6872
onRun:()=>{
6973
console.log('COMMAND TEST_RUN')
70-
webview.send({type:'TEST_RUN'})
74+
webview.send({type:'TEST_RUN',payload:{stepId}})
7175
}
7276
})
7377
},

‎web-app/src/services/channel/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Channel {
2525
this.machineSend=send
2626
}
2727
publicreceive=(event:ReceivedEvent)=>{
28-
console.log('CLIENT RECEIVE')
2928
constaction=event.data
3029

3130
//@ts-ignore // ignore browser events from plugins
@@ -41,16 +40,20 @@ class Channel {
4140
case'TEST_PASS':
4241
// { type: 'TEST_PASS', payload: { stepId: string }}
4342
this.machineSend(action)
44-
console.log('test passed')
4543
return
4644
case'TEST_FAIL':
4745
this.machineSend(action)
4846
return
4947
case'TEST_RUN':
5048
console.log('TEST_RUN')
49+
this.machineSend(action)
50+
return
51+
case'TEST_ERROR':
52+
console.log('TEST_ERROR')
53+
this.machineSend(action)
5154
return
5255
case'ACTIONS_LOADED':
53-
console.log('ACTIONS_LOADED')
56+
// TODO: use this for verifying completion of stepActions
5457
return
5558
default:
5659
if(action.type){

‎web-app/src/services/state/actions/context.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,10 @@ export default {
104104
//@ts-ignore
105105
updateStepProgress:assign({
106106
progress:(context:CR.MachineContext,event:CR.MachineEvent):CR.Progress=>{
107-
108107
// update progress by tracking completed
109108
constcurrentProgress:CR.Progress=context.progress
110109

111-
// TODO: should use event id, to verify not multiple successes jumping one
112-
// const stepId = event.payload.stepId
113-
const{stepId}=context.position
110+
const{stepId}=event.payload
114111

115112
currentProgress.steps[stepId]=true
116113

‎web-app/src/services/state/machine.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
124124
actions:['updateStepProgress']
125125
},
126126
TEST_FAIL:'TestFail',
127+
TEST_ERROR:'Normal'
127128
},
128129
},
129130
TestPass:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp