Skip to content

Commit

Permalink
Merge pull request #1053 from mikepenz/feature/1051
Browse files Browse the repository at this point in the history
Improve logging for test parsing
  • Loading branch information
mikepenz authored Mar 14, 2024
2 parents 034100c + 07c0ba5 commit 9379f0c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Test JUnit test import
Expand Down
1 change: 1 addition & 0 deletions __tests__/testParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
totalCount: 0,
skipped: 0,
failed: 0,
foundFiles: 1,
passed: 0,
annotations: []
})
Expand Down
7 changes: 6 additions & 1 deletion 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.

6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ export async function run(): Promise<void> {
skipped: 0,
failed: 0,
passed: 0,
foundFiles: 0,
annotations: []
}

core.info(`Retrieved ${reportsCount} reports to process.`)
core.info(`Preparing ${reportsCount} report as configured.`)

for (let i = 0; i < reportsCount; i++) {
const testResult = await parseTestReports(
Expand All @@ -79,11 +80,14 @@ export async function run(): Promise<void> {
truncateStackTraces
)

core.info(`Found and parsed ${testResult.foundFiles} test report files.`)

mergedResult.totalCount += testResult.totalCount
mergedResult.skipped += testResult.skipped
mergedResult.failed += testResult.failed
mergedResult.passed += testResult.passed
testResults.push(testResult)

}

core.setOutput('total', mergedResult.totalCount)
Expand Down
4 changes: 4 additions & 0 deletions src/testParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface TestResult {
skipped: number
failed: number
passed: number
foundFiles: number
annotations: Annotation[]
}

Expand Down Expand Up @@ -434,7 +435,9 @@ export async function parseTestReports(
let annotations: Annotation[] = []
let totalCount = 0
let skipped = 0
let foundFiles = 0
for await (const file of globber.globGenerator()) {
foundFiles++
core.debug(`Parsing report file: ${file}`)

const {
Expand Down Expand Up @@ -478,6 +481,7 @@ export async function parseTestReports(
skipped,
failed,
passed,
foundFiles,
annotations
}
}
Expand Down

0 comments on commit 9379f0c

Please sign in to comment.