Skip to content

Commit 427a7b3

Browse files
committed
alter parser for tap.py output
Signed-off-by: shmck <[email protected]>
1 parent 3df9151 commit 427a7b3

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Diff for: src/services/testRunner/parser.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ not ok 1 test_add_no_numbers (tests.math_test.MathTest)
225225
# AssertionError: 42 != 0 : Should return 0 with no params
226226
1..1`
227227
expect(parser(example)).toEqual({
228-
ok: true,
228+
ok: false,
229229
passed: [],
230230
failed: [
231231
{
232232
message: 'add no numbers',
233233
details:
234-
'Traceback (most recent call last):\n Fail Message\nAssertionError: 42 != 0 : Should return 0 with no params',
234+
'Traceback (most recent call last):\nFail Message\nAssertionError: 42 != 0 : Should return 0 with no params',
235235
},
236236
],
237237
logs: [],
@@ -251,13 +251,13 @@ not ok 2 test_add_one_number (tests.math_test.MathTest)
251251
1..2
252252
`
253253
expect(parser(example)).toEqual({
254-
ok: true,
254+
ok: false,
255255
passed: [{ message: 'add no numbers' }],
256256
failed: [
257257
{
258258
message: 'add one number',
259259
details:
260-
'Traceback (most recent call last):\n Fail Message\nAssertionError: 2 != 1 : Should add one number to 0',
260+
'Traceback (most recent call last):\nFail Message\nAssertionError: 2 != 1 : Should add one number to 0',
261261
},
262262
],
263263
logs: [],

Diff for: src/services/testRunner/parser.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const r = {
2323
start: /^(not ok)|(ok)/,
2424
fail: /^not ok (?<index>\d+)\s(\-\s)?(?<message>.+)$/,
2525
pass: /^ok (?<index>\d+)\s(\-\s)?(?<message>.+)$/,
26-
details: /^#\s{2}(?<message>.+)$/,
26+
details: /^#\s{1,2}(?<message>.+)$/,
2727
ignore: /^(1\.\.[0-9]+)|(#\s+(tests|pass|fail|skip)\s+[0-9]+)$/,
2828
}
2929

@@ -75,7 +75,7 @@ const parser = (text: string): ParserOutput => {
7575
}
7676

7777
for (const line of lines) {
78-
if (!line.length) {
78+
if (!line.length || !!r.ignore.exec(line)) {
7979
continue
8080
}
8181
// be optimistic! check for success first
@@ -121,11 +121,9 @@ const parser = (text: string): ParserOutput => {
121121
continue
122122
}
123123

124-
if (!r.ignore.exec(line)) {
125-
// must be a log, associate with the next test
126-
logs.push(line)
127-
result.logs.push(line)
128-
}
124+
// must be a log, associate with the next test
125+
logs.push(line)
126+
result.logs.push(line)
129127
}
130128
addCurrentDetails()
131129
return result

0 commit comments

Comments
 (0)