fix(tests): isolate fake timers and enrich signer error messages#344
Open
mehmetkr-31 wants to merge 3 commits into
Open
fix(tests): isolate fake timers and enrich signer error messages#344mehmetkr-31 wants to merge 3 commits into
mehmetkr-31 wants to merge 3 commits into
Conversation
Move vi.useRealTimers() cleanup from beforeEach return callback to afterEach to ensure parallel test runs don't leave fake timer state polluted. Resolves Node v24 + Vitest timeout and AbortSignal issues.
Enriches the generic unauthorized error thrown when handleAddSubAccountOwner fails by adding the request method, subAccount address, and underlying error detail to the message. This makes debugging signer failures tractable for developers.
Collaborator
🟡 Heimdall Review Status
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses two independent issues in the account-sdk:
1. Test Isolation (Node v24 + Vitest compatibility)
createSmartAccount.test.ts'sgetNoncedescribe block usedvi.useFakeTimers()insidebeforeEachwith a return cleanup callback. In Vitest + Node v24, this pattern leaves fake timer state polluted across parallel test runs, causing 6 tests to fail with timeouts orAbortSignalprototype mismatches.vi.useRealTimers()to an explicitafterEachhook. This guarantees cleanup regardless of test outcome.2. Signer Error Detail (#213)
handleAddSubAccountOwnerfails, the thrown error is completely generic:failed to add sub account owner when sending request to sub account signer. Developers cannot distinguish which method, subAccount, or underlying error caused the failure.request.method,subAccount.address, andparseErrorMessageFromAny(error)in the unauthorized error message.Test Plan
yarn workspace @base-org/account test --run→ 999/999 passRelated Issues