-
Notifications
You must be signed in to change notification settings - Fork 758
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: add type coverage #1102
feat: add type coverage #1102
Conversation
* chore(release): 6.8.0 [skip ci] # [6.8.0](starknet-io/starknet.js@v6.7.0...v6.8.0) (2024-04-23) ### Bug Fixes * starkne types 0.7 ([starknet-io#1087](starknet-io#1087)) ([b038c76](starknet-io@b038c76)) * tslib ([starknet-io#1068](starknet-io#1068)) ([dd7dc10](starknet-io@dd7dc10)) * **utils:** fix block identifier ([starknet-io#1076](starknet-io#1076)) ([0a3499d](starknet-io@0a3499d)) ### Features * add getGasPrice rpc provider method ([starknet-io#1056](starknet-io#1056)) ([d396275](starknet-io@d396275)) * Export function parseCalldataField() ([4d59658](starknet-io@4d59658)) * rpc 0.7.1 ([starknet-io#1071](starknet-io#1071)) ([11dc600](starknet-io@11dc600)) * docs: add paragrapher for encode decode tool * Update CHANGELOG.md --------- Co-authored-by: Toni Tabak <tabaktoni@gmail.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Ivan Pavičić <ivan.pavicic@live.com>
* chore: add examples to JsDoc for num.ts file * chores: implement requested update changes examples to JsDoc for num.ts file * chore: change @return to @returns for JsDoc examples in num.ts file --------- Co-authored-by: Toni Tabak <tabaktoni@gmail.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
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.
thanks!
we were thinking about removing this whole coverage-ts
folder , and instead just provide the option for developers to locally check if the type coverage is ok in the console... and this could be also added to our CI on every PR. So thinking about
https://github.com/plantain-00/type-coverage instead of https://github.com/alexcanessa/typescript-coverage-report
@ivpavici I removed the |
…s_to_domain refactor: getStarkName & getStarkProfile to work with latest version of contract
thanks! |
…t-io#1105)" (starknet-io#1108) This reverts commit 0ab0de7.
@@ -11,13 +13,13 @@ import { | |||
import type { GetTransactionReceiptResponse } from '../transactionReceipt'; | |||
|
|||
export abstract class ResponseParser { | |||
abstract parseGetBlockResponse(res: any): GetBlockResponse; | |||
abstract parseGetBlockResponse(res: BlockWithTxHashes): GetBlockResponse; |
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 have a serious doubt for this one.
@tabaktoni should have a look at all the types you added.
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.
The global ts coverage percentage is nice to have, but if the result is bad, the dev has nothing to identify what and where are the problems.
The report is anyway useful if the percentage has to be improved.
Maybe a npm command just to get the result value, but also a command to have the report if requested by the dev. Will have to be explained (also how to display the report) in CONTRIBUTE doc.
@PhilippeR26 Thanks for the review, I added typescript-coverage-report back and ignored the default output |
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.
-
After analysis, I think that the types added are good, but has to be confirmed by @tabaktoni .
-
Script for coverage report is generating a full screen warning :
Warning: Table: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
at Table (/home/edmond/Documents/starknet/starknet.js/node_modules/semantic-ui-react/dist/commonjs/collections/Table/Table.js:40:24)
at div
at Container
...
Can you solve that?
-
You should add in Contribute (otherwise sure it will be asked in the assistance ...) something like :
launch ./coverage-ts/index.html in your browser.
-
Target your PR to
next-version
* chore(release): 6.8.0 [skip ci] # [6.8.0](starknet-io/starknet.js@v6.7.0...v6.8.0) (2024-04-23) ### Bug Fixes * starkne types 0.7 ([starknet-io#1087](starknet-io#1087)) ([b038c76](starknet-io@b038c76)) * tslib ([starknet-io#1068](starknet-io#1068)) ([dd7dc10](starknet-io@dd7dc10)) * **utils:** fix block identifier ([starknet-io#1076](starknet-io#1076)) ([0a3499d](starknet-io@0a3499d)) ### Features * add getGasPrice rpc provider method ([starknet-io#1056](starknet-io#1056)) ([d396275](starknet-io@d396275)) * Export function parseCalldataField() ([4d59658](starknet-io@4d59658)) * rpc 0.7.1 ([starknet-io#1071](starknet-io#1071)) ([11dc600](starknet-io@11dc600)) * chore/add JsDoc for address.ts file * update/ change address jsDoc - Add quotes to address string - Change address to get more zeros * feat/ Add JSDoc for encode.ts * update/ fix comments of encode.ts * update/ Fix last comment --------- Co-authored-by: Toni Tabak <tabaktoni@gmail.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
In general looking lgtm |
@saimeunt can you please fix the last comments from Phil? and we can merge 👍 |
Will do tonight! |
@PhilippeR26 I was unable to make the warning disappear, it's caused by a non-critical issue in semantic-ui-react which is a dependency of typescript-coverage-report, this dependency will have to be updated to get rid of the issue. @ivpavici I'm closing this PR in favor of #1120 which is properly targetting next-version. |
Motivation and Resolution
This PR adds a new
ts:coverage
npm script that uses typescript-coverage-report to generage a TypeScript coverage report available in the coverage-ts directory.On initial run, every files had >80% coverage except 4:
src/utils/assert.ts
src/utils/calldata/formatter.ts
src/utils/calldata/parser/parser-2.0.0.ts
src/utils.responseParser/index.ts
I added some additional typings on these files to reach >80% coverage (not sure if these modifications are 100% correct though).
Resolves: #1088
RPC version (if applicable)
0.7.1
Usage related changes
None
Development related changes
New npm script added:
ts:coverage
Checklist: