Skip to content

Feature/subtask markdown #383

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 5 commits into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
show pass subtask when task passes
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 5, 2020
commit 9556a84ceae54be3dae8a33e65db98a7344c4ada
34 changes: 15 additions & 19 deletions src/services/testRunner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,7 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks) => {
return
}

console.log('STEP')
console.log(JSON.stringify(step))

// flag as running
// no need to flag subtasks as running
if (!step.setup?.subtasks) {
callbacks.onRun(position)
}
callbacks.onRun(position)

let result: { stdout: string | undefined; stderr: string | undefined }
try {
Expand Down Expand Up @@ -98,16 +91,6 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks) => {

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

if (step.setup.subtasks) {
const summary = parseSubtasks(tap.summary, position.stepId || '')

console.log('---subtask summary')
console.log(summary)
callbacks.onLoadSubtasks({ summary })
// exit early
return
}

addOutput({ channel: logChannelName, text: tap.logs.join('\n'), show: false })

if (stderr) {
Expand All @@ -128,7 +111,18 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks) => {
description: firstFail.details || 'Unknown error',
summary: tap.summary,
}
callbacks.onFail(position, failSummary)

if (step.setup.subtasks) {
const subtaskSummary = parseSubtasks(tap.summary, position.stepId || '')

callbacks.onFail(position, {
...failSummary,
summary: subtaskSummary,
})
} else {
callbacks.onFail(position, failSummary)
}

const output = formatFailOutput(tap)
addOutput({ channel: failChannelName, text: output, show: true })
return
Expand All @@ -142,13 +136,15 @@ const createTestRunner = (data: TT.Tutorial, callbacks: Callbacks) => {

// PASS
if (tap.ok) {
console.log('running pass')
clearOutput(failChannelName)

callbacks.onSuccess(position)

if (onSuccess) {
onSuccess()
}
5
} else {
// should never get here
onError(new Error(`Error with running test ${JSON.stringify(position)}`))
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/containers/Tutorial/components/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Step = (props: Props) => {
<ul css={styles.subtasks}>
{props.subtasks.map((subtask) => (
<li key={subtask.name} css={styles.subtask}>
<TestStatusIcon size="xs" checked={subtask.pass} />
<TestStatusIcon size="xs" checked={props.status === 'COMPLETE' || subtask.pass} />

<span style={{ marginLeft: '0.5rem' }}>{subtask.name}</span>
</li>
Expand Down