Skip to content

Commit

Permalink
- rebase and update testcase with new inputs
Browse files Browse the repository at this point in the history
- small adjustments to align with skipped behavior
  • Loading branch information
mikepenz committed Nov 28, 2024
1 parent eb88944 commit 319aaf3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 30 deletions.
50 changes: 26 additions & 24 deletions __tests__/testParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1270,17 +1270,19 @@ describe('parseTestReports', () => {
})

it('should parse retried tests', async () => {
const {checkName, summary, totalCount, skipped, failed, passed, retried, globalAnnotations} = await parseTestReports(
'checkName',
'summary',
'test_results/junit-server-test/report.xml',
'*',
true,
true,
[],
'{{SUITE_NAME}}/{{TEST_NAME}}',
'/'
)
const {checkName, summary, totalCount, skipped, failed, passed, retried, globalAnnotations} =
await parseTestReports(
'checkName',
'summary',
'test_results/junit-server-test/report.xml',
'*',
true,
true,
true,
[],
'{{SUITE_NAME}}/{{TEST_NAME}}',
'/'
)

expect(checkName).toBe('checkName')
expect(summary).toBe('summary')
Expand Down Expand Up @@ -1314,21 +1316,21 @@ describe('parseTestReports', () => {
start_column: 0,
start_line: 1,
status: 'skipped',
title: 'github.com/example/example/server/v8/channels/api4/TestCreateChannelBookmark',
title: 'github.com/example/example/server/v8/channels/api4/TestCreateChannelBookmark'
},
{
annotation_level: 'notice',
end_column: 0,
end_line: 1,
message: 'TestWebSocketUpgrade',
path: 'com/example/example/server/v8/channels/api4',
raw_details: '',
retries: 0,
start_column: 0,
start_line: 1,
status: 'success',
title: 'github.com/example/example/server/v8/channels/api4/TestWebSocketUpgrade',
}
annotation_level: 'notice',
end_column: 0,
end_line: 1,
message: 'TestWebSocketUpgrade',
path: 'com/example/example/server/v8/channels/api4',
raw_details: '',
retries: 0,
start_column: 0,
start_line: 1,
status: 'success',
title: 'github.com/example/example/server/v8/channels/api4/TestWebSocketUpgrade'
}
])
})

Expand Down
20 changes: 18 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/testParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ async function parseSuite(
childSuiteResults.push(childSuiteResult)
totalCount += childSuiteResult.totalCount
skippedCount += childSuiteResult.skippedCount
retriedCount += childSuiteResult.retriedCount
}

// skip out if we reached our annotations limit
Expand Down Expand Up @@ -424,7 +425,6 @@ async function parseTestCases(
testcaseMap.set(key, testcase)
retriedCount += 1
core.debug(`Drop flaky test failure for (2): ${JSON.stringify(testcase)}`)
core.debug(`Drop flaky test failure for (2): ${key}`)
}
} else {
testcaseMap.set(key, testcase)
Expand Down Expand Up @@ -599,6 +599,7 @@ export async function parseTestReports(
const testResults: ActualTestResult[] = []
let totalCount = 0
let skipped = 0
let retried = 0
let foundFiles = 0
for await (const file of globber.globGenerator()) {
foundFiles++
Expand All @@ -623,9 +624,10 @@ export async function parseTestReports(
)

if (!testResult) continue
const {totalCount: c, skippedCount: s} = testResult
const {totalCount: c, skippedCount: s, retriedCount: r} = testResult
totalCount += c
skipped += s
retried += r
testResults.push(testResult)

if (annotationsLimit > 0 && globalAnnotations.length >= annotationsLimit) {
Expand All @@ -636,7 +638,6 @@ export async function parseTestReports(
// get the count of passed and failed tests.
const failed = globalAnnotations.filter(a => a.annotation_level === 'failure').length
const passed = totalCount - failed - skipped
const retried = globalAnnotations.filter(a => a.retries > 0).length

return {
checkName,
Expand Down

0 comments on commit 319aaf3

Please sign in to comment.