Skip to content

add python support #377

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 4 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

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
alter parser for tap.py output
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 27, 2020
commit 427a7b31bc5f8f9e4bb1de5c3fefd83c0cacce86
8 changes: 4 additions & 4 deletions src/services/testRunner/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ not ok 1 test_add_no_numbers (tests.math_test.MathTest)
# AssertionError: 42 != 0 : Should return 0 with no params
1..1`
expect(parser(example)).toEqual({
ok: true,
ok: false,
passed: [],
failed: [
{
message: 'add no numbers',
details:
'Traceback (most recent call last):\n Fail Message\nAssertionError: 42 != 0 : Should return 0 with no params',
'Traceback (most recent call last):\nFail Message\nAssertionError: 42 != 0 : Should return 0 with no params',
},
],
logs: [],
Expand All @@ -251,13 +251,13 @@ not ok 2 test_add_one_number (tests.math_test.MathTest)
1..2
`
expect(parser(example)).toEqual({
ok: true,
ok: false,
passed: [{ message: 'add no numbers' }],
failed: [
{
message: 'add one number',
details:
'Traceback (most recent call last):\n Fail Message\nAssertionError: 2 != 1 : Should add one number to 0',
'Traceback (most recent call last):\nFail Message\nAssertionError: 2 != 1 : Should add one number to 0',
},
],
logs: [],
Expand Down
12 changes: 5 additions & 7 deletions src/services/testRunner/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const r = {
start: /^(not ok)|(ok)/,
fail: /^not ok (?<index>\d+)\s(\-\s)?(?<message>.+)$/,
pass: /^ok (?<index>\d+)\s(\-\s)?(?<message>.+)$/,
details: /^#\s{2}(?<message>.+)$/,
details: /^#\s{1,2}(?<message>.+)$/,
ignore: /^(1\.\.[0-9]+)|(#\s+(tests|pass|fail|skip)\s+[0-9]+)$/,
}

Expand Down Expand Up @@ -75,7 +75,7 @@ const parser = (text: string): ParserOutput => {
}

for (const line of lines) {
if (!line.length) {
if (!line.length || !!r.ignore.exec(line)) {
continue
}
// be optimistic! check for success first
Expand Down Expand Up @@ -121,11 +121,9 @@ const parser = (text: string): ParserOutput => {
continue
}

if (!r.ignore.exec(line)) {
// must be a log, associate with the next test
logs.push(line)
result.logs.push(line)
}
// must be a log, associate with the next test
logs.push(line)
result.logs.push(line)
}
addCurrentDetails()
return result
Expand Down