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

Commit81fee84

Browse files
authored
Merge pull request#31 from ShMcK/feature/run-on-save
run tests from save
2 parentsae2462b +eedcd4b commit81fee84

File tree

6 files changed

+21
-31
lines changed

6 files changed

+21
-31
lines changed

‎src/Channel.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@ class Channel implements Channel {
2222
console.log('RECEIVED:',actionType)
2323
switch(actionType){
2424
case'TEST_RUN':
25-
2625
vscode.commands.executeCommand('coderoad.run_test',action.payload)
2726
return
2827
case'TUTORIAL_CONFIG':
2928
tutorialConfig(action.payload)
3029
return
3130
case'SETUP_ACTIONS':
32-
console.log(action.payload)
31+
vscode.commands.executeCommand('coderoad.set_current_step',action.payload)
3332
setupActions(action.payload)
3433
return
3534
case'SOLUTION_ACTIONS':
36-
console.log(action.payload)
3735
solutionActions(action.payload)
3836
return
3937
default:

‎src/actions/runTest.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ async function runTest({onSuccess, onFail, onRun, onError}: Props): Promise<void
139139
channel.show(false)
140140
channel.appendLine(stderr)
141141
}
142-
// if (err.stdout) {
143-
// channel.appendLine(err.stdout);
144-
// }
145142
}
146143
}
147144

‎src/actions/tutorialConfig.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ const tutorialConfig = async (tutorial: G.Tutorial) => {
99
awaitgit.setupRemote(tutorial.repo.uri)
1010

1111
// TODO: allow multiple coding languages in a tutorial
12+
constlanguage=tutorial.codingLanguage.toLowerCase()
1213

1314
// setup onSave hook
1415
// console.log(`languageIds: ${languageIds.join(', ')}`)
1516
vscode.workspace.onDidSaveTextDocument((document:vscode.TextDocument)=>{
16-
if(document.uri.scheme==='file'&&tutorial.codingLanguage===document.languageId){
17-
// do work
18-
// TODO: resolve issue if client unaware or out of sync with running test
17+
if(document.uri.scheme==='file'&&language===document.languageId){
1918
vscode.commands.executeCommand('coderoad.run_test')
2019
}
2120
})
22-
23-
console.log('configured')
2421
}
2522

2623
exportdefaulttutorialConfig

‎src/editor/commands.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const COMMANDS = {
77
START:'coderoad.start',
88
OPEN_WEBVIEW:'coderoad.open_webview',
99
RUN_TEST:'coderoad.run_test',
10+
SET_CURRENT_STEP:'coderoad.set_current_step',
1011
}
1112

1213
interfaceCreateCommandProps{
@@ -16,7 +17,7 @@ interface CreateCommandProps {
1617
exportconstcreateCommands=({vscodeExt}:CreateCommandProps)=>{
1718
// React panel webview
1819
letwebview:any
19-
20+
letcurrentStepId=''
2021
return{
2122
// initialize
2223
[COMMANDS.START]:async()=>{
@@ -52,26 +53,32 @@ export const createCommands = ({vscodeExt}: CreateCommandProps) => {
5253

5354
webview.createOrShow(column)
5455
},
55-
[COMMANDS.RUN_TEST]:({stepId}:{stepId:string})=>{
56-
console.log('run test webview',Object.keys(webview))
56+
[COMMANDS.SET_CURRENT_STEP]:({stepId}:{stepId:string})=>{
57+
// NOTE: as async, may sometimes be inaccurate
58+
// set from last setup stepAction
59+
currentStepId=stepId
60+
},
61+
[COMMANDS.RUN_TEST]:(current:{stepId:string}|undefined)=>{
62+
// use stepId from client, or last set stepId
63+
constpayload={stepId:current ?current.stepId :currentStepId}
5764
runTest({
5865
onSuccess:()=>{
5966
console.log('COMMAND TEST_PASS')
60-
webview.send({type:'TEST_PASS',payload:{stepId}})
67+
webview.send({type:'TEST_PASS', payload})
6168
vscode.window.showInformationMessage('PASS')
6269
},
6370
onFail:()=>{
6471
console.log('COMMAND TEST_FAIL')
65-
webview.send({type:'TEST_FAIL',payload:{stepId}})
72+
webview.send({type:'TEST_FAIL', payload})
6673
vscode.window.showWarningMessage('FAIL')
6774
},
6875
onError:()=>{
6976
console.log('COMMAND TEST_ERROR')
70-
webview.send({type:'TEST_ERROR',payload:[stepId]})
77+
webview.send({type:'TEST_ERROR', payload})
7178
},
7279
onRun:()=>{
7380
console.log('COMMAND TEST_RUN')
74-
webview.send({type:'TEST_RUN',payload:{stepId}})
81+
webview.send({type:'TEST_RUN', payload})
7582
}
7683
})
7784
},

‎src/services/node/index.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,3 @@ class Node {
2323
}
2424

2525
exportdefaultnewNode()
26-
27-
28-
// export async function clear(): Promise<void> {
29-
// // remove all files including ignored
30-
// // NOTE: Linux only
31-
// const command = 'ls -A1 | xargs rm -rf'
32-
// const { stderr } = await exec(command)
33-
// if (stderr) {
34-
// console.error(stderr)
35-
// throw new Error('Error removing all files & folders')
36-
// }
37-
// }

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ export default {
5757
// load step actions
5858
channel.editorSend({
5959
type:'SETUP_ACTIONS',
60-
payload:step.setup,
60+
payload:{
61+
stepId:step.id,
62+
...step.setup,
63+
}
6164
})
6265
}
6366
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp