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

run tests from save#31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromfeature/run-on-save
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletionssrc/Channel.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,18 +22,16 @@ class Channel implements Channel {
console.log('RECEIVED:', actionType)
switch (actionType) {
case 'TEST_RUN':

vscode.commands.executeCommand('coderoad.run_test', action.payload)
return
case 'TUTORIAL_CONFIG':
tutorialConfig(action.payload)
return
case 'SETUP_ACTIONS':
console.log(action.payload)
vscode.commands.executeCommand('coderoad.set_current_step',action.payload)
setupActions(action.payload)
return
case 'SOLUTION_ACTIONS':
console.log(action.payload)
solutionActions(action.payload)
return
default:
Expand Down
3 changes: 0 additions & 3 deletionssrc/actions/runTest.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -139,9 +139,6 @@ async function runTest({onSuccess, onFail, onRun, onError}: Props): Promise<void
channel.show(false)
channel.appendLine(stderr)
}
// if (err.stdout) {
// channel.appendLine(err.stdout);
// }
}
}

Expand Down
7 changes: 2 additions & 5 deletionssrc/actions/tutorialConfig.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,18 +9,15 @@ const tutorialConfig = async (tutorial: G.Tutorial) => {
await git.setupRemote(tutorial.repo.uri)

// TODO: allow multiple coding languages in a tutorial
const language = tutorial.codingLanguage.toLowerCase()

// setup onSave hook
// console.log(`languageIds: ${languageIds.join(', ')}`)
vscode.workspace.onDidSaveTextDocument((document: vscode.TextDocument) => {
if (document.uri.scheme === 'file' && tutorial.codingLanguage === document.languageId) {
// do work
// TODO: resolve issue if client unaware or out of sync with running test
if (document.uri.scheme === 'file' && language === document.languageId) {
vscode.commands.executeCommand('coderoad.run_test')
}
})

console.log('configured')
}

export default tutorialConfig
21 changes: 14 additions & 7 deletionssrc/editor/commands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ const COMMANDS = {
START: 'coderoad.start',
OPEN_WEBVIEW: 'coderoad.open_webview',
RUN_TEST: 'coderoad.run_test',
SET_CURRENT_STEP: 'coderoad.set_current_step',
}

interface CreateCommandProps {
Expand All@@ -16,7 +17,7 @@ interface CreateCommandProps {
export const createCommands = ({vscodeExt}: CreateCommandProps) => {
// React panel webview
let webview: any

let currentStepId = ''
return {
// initialize
[COMMANDS.START]: async () => {
Expand DownExpand Up@@ -52,26 +53,32 @@ export const createCommands = ({vscodeExt}: CreateCommandProps) => {

webview.createOrShow(column)
},
[COMMANDS.RUN_TEST]: ({stepId}: {stepId: string}) => {
console.log('run test webview', Object.keys(webview))
[COMMANDS.SET_CURRENT_STEP]: ({stepId}: {stepId: string}) => {
// NOTE: as async, may sometimes be inaccurate
// set from last setup stepAction
currentStepId = stepId
},
[COMMANDS.RUN_TEST]: (current: {stepId: string} | undefined) => {
// use stepId from client, or last set stepId
const payload = {stepId: current ? current.stepId : currentStepId}
runTest({
onSuccess: () => {
console.log('COMMAND TEST_PASS')
webview.send({type: 'TEST_PASS', payload: {stepId}})
webview.send({type: 'TEST_PASS', payload})
vscode.window.showInformationMessage('PASS')
},
onFail: () => {
console.log('COMMAND TEST_FAIL')
webview.send({type: 'TEST_FAIL', payload: {stepId}})
webview.send({type: 'TEST_FAIL', payload})
vscode.window.showWarningMessage('FAIL')
},
onError: () => {
console.log('COMMAND TEST_ERROR')
webview.send({type: 'TEST_ERROR', payload: [stepId]})
webview.send({type: 'TEST_ERROR', payload})
},
onRun: () => {
console.log('COMMAND TEST_RUN')
webview.send({type: 'TEST_RUN', payload: {stepId}})
webview.send({type: 'TEST_RUN', payload})
}
})
},
Expand Down
12 changes: 0 additions & 12 deletionssrc/services/node/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,15 +23,3 @@ class Node {
}

export default new Node()


// export async function clear(): Promise<void> {
// // remove all files including ignored
// // NOTE: Linux only
// const command = 'ls -A1 | xargs rm -rf'
// const { stderr } = await exec(command)
// if (stderr) {
// console.error(stderr)
// throw new Error('Error removing all files & folders')
// }
// }
5 changes: 4 additions & 1 deletionweb-app/src/services/state/actions/editor.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,10 @@ export default {
// load step actions
channel.editorSend({
type: 'SETUP_ACTIONS',
payload: step.setup,
payload: {
stepId: step.id,
...step.setup,
}
})
}
},
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp