Skip to content

Commit

Permalink
fix: support skipped testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 committed May 31, 2020
1 parent f0d04f8 commit 896303b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/analyzer/circleci_analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { sumBy, min, max, sortBy, first, last } from "lodash"
import { Status, diffSec, Analyzer, secRound, TestReport } from "./analyzer"
import { WorkflowRun, SingleBuildResponse, CircleciStatus, TestResponse } from "../client/circleci_client"
import { RepositoryTagMap } from "../client/github_repository_client"
import { TestSuites, TestSuite, TestCase } from "junit2json"
import { TestSuite, TestCase } from "junit2json"

type WorkflowReport = {
// workflow
Expand Down Expand Up @@ -157,14 +157,16 @@ export class CircleciAnalyzer implements Analyzer {
classname: test.classname,
name: test.name,
time: test.run_time,
failure: (test.result === 'success') ? undefined : [{ inner: test.message }],
failure: (test.result === 'failure') ? [{ inner: test.message }] : undefined,
skipped: (test.result === 'skipped') ? [{ message: test.message }] : undefined,
}
})
return {
name: jobs.find((job) => job.build_num === test.run_id)?.workflows.job_name ?? '',
time: secRound(sumBy(testCases, 'time')),
tests: testCases.length,
failures: testCases.filter((testcase) => testcase.failure !== undefined).length,
skipped: testCases.filter((testcase) => testcase.skipped !== undefined).length,
timestamp: firstJob.start_time,
testcase: testCases,
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/circleci_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export type TestResponse = {
classname: string
file?: string
name: string
result: "success" | "failure"
result: "success" | "failure" | "skipped"
run_time: number
message?: string
source: string
Expand Down

0 comments on commit 896303b

Please sign in to comment.