chore: fix anchor escrow program tests #502
Open
+895
−882
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.
Scope:
tokens/escrow/anchor→ testsThe current
TLDR; I upgraded all the
package.jsondeps to latest and fixed the TS config & ESM/CJS interop bugs to make sure the tests pass without changing logicMotivation
The current tests don't work. At first we are greeted with this error, then many more follow
Changes
Core Configuration
TypeScript: Updated
tsconfig.jsontoesnextwithresolveJsonModule: trueto support modern ESM syntax and direct IDL imports.Imports: Switched to default imports for
@coral-xyz/anchorto fixBNconstructor errors in ESM.Bankrun Compatibility:
connection.getTokenAccountBalancewithgetAccountfrom@solana/spl-token.confirmTransactioncalls as Bankrun processes transactions instantly.Mocha Integration:
tests/bankrun.test.tsto use synchronousdescribeblocks and Mocha hooks instead ofnode:test.Programinstance.Verification Results
anchor testpasses with all 4 tests successful.Note: I tried to deduce the the missing Prettier config to minimize diff noise (trailing comma, single Quote) but the test files don't use one convention
AI usage
I used some AI assistance, but reviewed the changes carefully to make sure everything is relevant and minimize noise