Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display gas used for unit tests (FuelLabs#4178)
## Description closes FuelLabs#2411. This PR adds used gas information to the output of `forc test`. An example run can be seen below: <img width="534" alt="Screen Shot 2023-02-24 at 4 47 29 PM" src="https://user-images.githubusercontent.com/20915464/221198624-a3bdb264-2182-4b9d-9497-7d8cfe84132b.png"> This is done automatically without any flags. I felt like this should be the default way but open to suggestions if you feel like it should be behind a flag like `--gas-usage`. Also by accessing `TestResult` structs new used gas field, we can add this information into vscode plugin just like FuelLabs#513. We do not have a line by line gas cast information just yet but we could show the whole test's used gas info next to the run button or something in vscode. Thoughts @JoshuaBatty @sdankel Please let me know if anyone has any requests around the flag and the way we are printing the used gas. Maybe @nfurfaro could have some ideas as the prime user of `forc-test` 😄 ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers.
- Loading branch information