Skip to content

Conversation

@a-hariti
Copy link

@a-hariti a-hariti commented Jan 5, 2026

Scope: tokens/escrow/anchor → tests

The current
TLDR; I upgraded all the package.json deps to latest and fixed the TS config & ESM/CJS interop bugs to make sure the tests pass without changing logic

Motivation

The current tests don't work. At first we are greeted with this error, then many more follow

image

Changes

Core Configuration

  • TypeScript: Updated tsconfig.json to esnext with resolveJsonModule: true to support modern ESM syntax and direct IDL imports.

  • Imports: Switched to default imports for @coral-xyz/anchor to fix BN constructor errors in ESM.

  • Bankrun Compatibility:

    • Replaced unsupported connection.getTokenAccountBalance with getAccount from @solana/spl-token.
    • Removed redundant confirmTransaction calls as Bankrun processes transactions instantly.
  • Mocha Integration:

    • Refactored tests/bankrun.test.ts to use synchronous describe blocks and Mocha hooks instead of node:test.
    • Fixed incorrect type casting for the Anchor Program instance.

Verification Results

  • anchor test passes 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

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.

1 participant