Skip to content

Feature/output channel #557

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 3, 2022
Prev Previous commit
Next Next commit
clean up test fail logs
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jan 2, 2022
commit 8653dcae17f681056fd1ea3fc8b09240e585061d
10 changes: 5 additions & 5 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ interface CreateCommandProps {
}

let sendToClient = (action: T.Action): void => {
// function is replaced when webclient loads
// function is replaced when webview mounts
}

// This makes it easier to pass the send
// function throughout the codebase
export const send = (action: T.Action): void => {
logger(`EXT TO CLIENT: "${typeof action === 'string' ? action : action.type}"`)

if (action) sendToClient(action)
// log send of event to client
logger(`${typeof action === 'string' ? action : action.type}`)
sendToClient(action)
}

export const createCommands = (commandProps: CreateCommandProps): { [key: string]: any } => {
Expand Down Expand Up @@ -91,7 +91,7 @@ export const createCommands = (commandProps: CreateCommandProps): { [key: string
},
onRun: (position: T.Position) => {
// send test run message back to client
send({ type: 'TEST_RUNNING', payload: { position } })
send({ type: 'START_TEST', payload: { position } })
},
onLoadSubtasks: ({ summary }) => {
send({ type: 'LOAD_SUBTASK_RESULTS', payload: { summary } })
Expand Down
8 changes: 5 additions & 3 deletions src/services/testRunner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks): ((params: an
command = [command, testRunnerFilterArg, testFilter].join(' ')
}
}
logger('COMMAND', command)
logger(`COMMAND: ${command}`)
result = await exec({ command, dir: testRunnerConfig.directory })
} catch (err: any) {
result = { stdout: err.stdout, stderr: err.stack }
Expand All @@ -84,13 +84,15 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks): ((params: an
return
}

logger('----------------- PROCESS TEST -----------------')
logger('---------------- TEST RESULTS -----------------')

const { stdout, stderr } = result

const tap: ParserOutput = parser(stdout || '')

logger(tap.logs.join('\n'))
if (tap.logs.length) {
logger(tap.logs.join('\n'))
}

if (stderr) {
if (!tap.failed.length) {
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const createMachine = (options: any) => {
LOAD_SUBTASK_RESULTS: {
actions: ['testSubtasks'],
},
TEST_RUNNING: 'TestRunning',
START_TEST: 'TestRunning',
STEP_SOLUTION_LOAD: {
actions: ['editorLoadSolution'],
},
Expand Down