Skip to content

Conversation

@schaable
Copy link
Member

@schaable schaable commented Oct 1, 2025

This PR adds basic snapshot testing for gas statistics. Ideally we'd use something like Jest snapshots, but I avoided adding dependencies due to recent npm security issues. I'll revisit this approach when we implement gas stats for Solidity tests, since we'll need snapshot testing there as well. the combined gas statistics table.

@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2025

⚠️ No Changeset found

Latest commit: 5976bd4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@schaable schaable requested a review from Copilot October 1, 2025 22:30
@schaable schaable force-pushed the gas-stats-snapshot-tests branch from d6d0d2e to 1ae0771 Compare October 1, 2025 22:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements basic snapshot testing for gas usage statistics to track and validate gas consumption in smart contract tests. The author chose a custom implementation to avoid adding external dependencies due to security concerns, with plans to revisit for Solidity tests.

  • Adds a custom snapshot testing system that captures gas statistics from Hardhat test runs
  • Creates comprehensive test suites for Counter and Calculator contracts to generate gas usage data
  • Integrates snapshot testing into the project's test workflow

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v-next/example-project/test/snapshot-test.js Implements custom snapshot testing functionality for gas statistics
v-next/example-project/test/node/counter.ts Adds Node.js test suite for Counter contract with various gas-consuming operations
v-next/example-project/test/node/calculator.ts Adds Node.js test suite for Calculator contract with comprehensive operation coverage
v-next/example-project/package.json Updates test scripts to include snapshot testing commands
v-next/example-project/contracts/Counter.sol Enhances Counter contract with additional functions for comprehensive gas testing
v-next/example-project/contracts/Calculator.sol Adds new Calculator contract with arithmetic operations for gas testing
v-next/example-project/.snapshots/gas-stats Creates initial gas statistics snapshot file
v-next/config/.prettierignore Excludes snapshot directory from Prettier formatting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@schaable schaable requested a review from fvictorio October 1, 2025 22:35
Base automatically changed from gas-statistics to main October 23, 2025 14:55
@schaable schaable force-pushed the gas-stats-snapshot-tests branch from 1ae0771 to 56aeef9 Compare October 23, 2025 15:00
@schaable schaable self-assigned this Oct 23, 2025
@schaable schaable added no docs needed This PR doesn't require links to documentation no changeset needed This PR doesn't require a changeset labels Oct 23, 2025
@schaable schaable marked this pull request as ready for review October 23, 2025 15:13
@schaable schaable force-pushed the gas-stats-snapshot-tests branch from 12c84f6 to 98a4d52 Compare October 23, 2025 16:23
@schaable schaable marked this pull request as draft October 29, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changeset needed This PR doesn't require a changeset no docs needed This PR doesn't require links to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants