-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: Create hook for test results #3044
Conversation
Bundle ReportChanges will increase total bundle size by 533 bytes ⬆️
|
Bundle ReportChanges will increase total bundle size by 533 bytes ⬆️
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3044 +/- ##
=======================================
Coverage 98.36% 98.37%
=======================================
Files 914 915 +1
Lines 13604 13642 +38
Branches 3679 3703 +24
=======================================
+ Hits 13382 13420 +38
Misses 218 218
Partials 4 4
... and 5 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3044 +/- ##
=======================================
Coverage 98.36% 98.37%
=======================================
Files 914 915 +1
Lines 13604 13642 +38
Branches 3657 3698 +41
=======================================
+ Hits 13382 13420 +38
Misses 218 218
Partials 4 4
... and 5 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #3044 +/- ##
================================================
+ Coverage 98.36000 98.37000 +0.01000
================================================
Files 914 915 +1
Lines 13604 13642 +38
Branches 3657 3674 +17
================================================
+ Hits 13382 13420 +38
Misses 218 218
Partials 4 4
... and 5 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3044 +/- ##
=======================================
Coverage 98.36% 98.37%
=======================================
Files 914 915 +1
Lines 13604 13642 +38
Branches 3679 3698 +19
=======================================
+ Hits 13382 13420 +38
Misses 218 218
Partials 4 4
... and 5 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of comments to peak at
const query = ` | ||
query GetTestResults( | ||
$owner: String! | ||
$repo: String! | ||
$filters: TestResultsFilters | ||
$first: Int | ||
$after: String | ||
$last: Int | ||
$before: String | ||
) { | ||
owner(username: $owner) { | ||
repository: repository(name: $repo) { | ||
__typename | ||
... on Repository { | ||
testResults(filters: $filters, first: $first, after: $after, last: $last, before: $before) { | ||
edges { | ||
node { | ||
updatedAt | ||
avgDuration | ||
name | ||
failureRate | ||
commitsFailed | ||
} | ||
} | ||
pageInfo { | ||
endCursor | ||
hasNextPage | ||
} | ||
} | ||
} | ||
... on NotFoundError { | ||
message | ||
} | ||
... on OwnerNotActivatedError { | ||
message | ||
} | ||
} | ||
} | ||
}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l
: Just tidying up the testResults args formatting
const query = ` | |
query GetTestResults( | |
$owner: String! | |
$repo: String! | |
$filters: TestResultsFilters | |
$first: Int | |
$after: String | |
$last: Int | |
$before: String | |
) { | |
owner(username: $owner) { | |
repository: repository(name: $repo) { | |
__typename | |
... on Repository { | |
testResults(filters: $filters, first: $first, after: $after, last: $last, before: $before) { | |
edges { | |
node { | |
updatedAt | |
avgDuration | |
name | |
failureRate | |
commitsFailed | |
} | |
} | |
pageInfo { | |
endCursor | |
hasNextPage | |
} | |
} | |
} | |
... on NotFoundError { | |
message | |
} | |
... on OwnerNotActivatedError { | |
message | |
} | |
} | |
} | |
}` | |
const query = ` | |
query GetTestResults( | |
$owner: String! | |
$repo: String! | |
$filters: TestResultsFilters | |
$first: Int | |
$after: String | |
$last: Int | |
$before: String | |
) { | |
owner(username: $owner) { | |
repository: repository(name: $repo) { | |
__typename | |
... on Repository { | |
testResults( | |
filters: $filters | |
first: $first | |
after: $after | |
last: $last | |
before: $before | |
) { | |
edges { | |
node { | |
updatedAt | |
avgDuration | |
name | |
failureRate | |
commitsFailed | |
} | |
} | |
pageInfo { | |
endCursor | |
hasNextPage | |
} | |
} | |
} | |
... on NotFoundError { | |
message | |
} | |
... on OwnerNotActivatedError { | |
message | |
} | |
} | |
} | |
}` |
data?.owner?.repository?.testResults?.edges?.map( | ||
(edge) => edge.node | ||
) ?? [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m
: We have a typesafe util function to do this mapping for you, and will handle all of the potential other cases for you as well: mapEdges
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually tried to use it but for some reason it fails when using it. I think something's off with the expected returned type in mapEdges i've seen this happen with useInfiniteQuery a couple of times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any tip is welcomed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do the following and it'll make everything happy:
testResults: mapEdges(data?.owner?.repository?.testResults).filter(
(item): item is TestResult => item !== null
),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Create hook for test results new table
closes: codecov/engineering-team#2071
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.