Skip to content

Conversation

@goncalvesnelson
Copy link
Contributor

Ensure that the original BigNumber.DEBUG value is restored after running any of the BigNumber asserts.

Copilot AI review requested due to automatic review settings November 19, 2025 15:17
@goncalvesnelson goncalvesnelson requested review from a team as code owners November 19, 2025 15:17
Copy link

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 refactors the BigNumber.DEBUG state management to ensure the original value is always restored after assertions complete, preventing side effects that could affect other code using BigNumber.

  • Centralized BigNumber.DEBUG state management in the base BigNumberAssert class with proper cleanup
  • Removed redundant BigNumber.DEBUG assignments from all comparison assert constructors
  • Added comprehensive test coverage for DEBUG restoration in success, validation failure, and constructor failure scenarios

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/asserts/big-number-assert.js Implements DEBUG state preservation using try-finally pattern in the validate method
src/asserts/big-number-equal-to-assert.js Removes redundant DEBUG assignment from constructor
src/asserts/big-number-greater-than-assert.js Removes redundant DEBUG assignment from constructor
src/asserts/big-number-greater-than-or-equal-to-assert.js Removes redundant DEBUG assignment from constructor
src/asserts/big-number-less-than-assert.js Removes redundant DEBUG assignment from constructor
src/asserts/big-number-less-than-or-equal-to-assert.js Removes redundant DEBUG assignment from constructor
test/asserts/big-number-assert.test.js Adds tests verifying DEBUG restoration for successful and failed validations
test/asserts/big-number-equal-to-assert.test.js Adds tests verifying DEBUG restoration across all validation scenarios
test/asserts/big-number-greater-than-assert.test.js Adds tests verifying DEBUG restoration across all validation scenarios
test/asserts/big-number-greater-than-or-equal-to-assert.test.js Adds tests verifying DEBUG restoration across all validation scenarios
test/asserts/big-number-less-than-assert.test.js Adds tests verifying DEBUG restoration across all validation scenarios
test/asserts/big-number-less-than-or-equal-to-assert.test.js Adds tests verifying DEBUG restoration across all validation scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@goncalvesnelson goncalvesnelson force-pushed the support/fix-bignumber-assert-debug-side-effect branch from 9ee906e to bbadb0a Compare November 19, 2025 15:42
@Americas Americas merged commit d577f09 into master Nov 19, 2025
2 checks passed
@Americas Americas deleted the support/fix-bignumber-assert-debug-side-effect branch November 19, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants