Skip to content

Use LiteSVM for JS client tests#76

Merged
lorisleiva merged 3 commits intomainfrom
loris/litesvm-js-tests
Apr 21, 2026
Merged

Use LiteSVM for JS client tests#76
lorisleiva merged 3 commits intomainfrom
loris/litesvm-js-tests

Conversation

@lorisleiva
Copy link
Copy Markdown
Member

@lorisleiva lorisleiva commented Apr 21, 2026

This PR removes the need for a local validator in the JS client tests by using LiteSVM as a test framework. It does this by simply replacing the solanaLocalRpc plugin with the litesvm one.

This PR also removes the test validator scripts since they are no longer needed by any command in the Makefile.

@lorisleiva lorisleiva marked this pull request as ready for review April 21, 2026 08:58
@lorisleiva
Copy link
Copy Markdown
Member Author

@trevor-cortex

Copy link
Copy Markdown

@trevor-cortex trevor-cortex left a comment

Choose a reason for hiding this comment

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

Summary

Swaps the JS client test runtime from a locally-spawned solana-test-validator (driven by @solana/kit-plugin-rpc / solanaLocalRpc) to in-process LiteSVM via @solana/kit-plugin-litesvm. The Makefile no longer starts/stops a validator around pnpm test, the now-unused scripts/restart-test-validator.sh and scripts/stop-test-validator.sh are deleted along with their README section, and advanceNonceAccount.test.ts calls client.svm.expireBlockhash() to compensate for LiteSVM not advancing blockhashes on its own.

Clean, well-scoped change — tests should now run without any external process, which is a nice DX and CI win.

Things to watch out for

  • client.svm escape hatch: the nonce test now reaches into a LiteSVM-specific handle on the client. That's fine and pragmatic, but it couples this one test to the LiteSVM plugin; if you ever want to run these tests against a real RPC again, that line will need to be guarded or abstracted. Probably not worth doing now — just worth being aware of.
  • CI cleanup (nit): .github/workflows/main.yml's test_client_js job still sets solana: true in the setup action, which installs the Solana CLI. With the validator gone from make test-js, that input looks unnecessary now and could be dropped in this PR or a follow-up to speed up the job.
  • Lockfile churn: the pnpm-lock.yaml diff is almost entirely the expected platform-specific native binary entries for litesvm (litesvm-{darwin,linux}-{arm64,x64}[-gnu|-musl]) plus the new plugin resolution. Nothing unexpected.

Notes for subsequent reviewers

  • Worth a quick local make test-js on a clean checkout to confirm nothing else implicitly relied on an RPC at localhost:8899.
  • Confirm the NonceBlockhashNotExpired behaviour described in the new comment matches LiteSVM's actual semantics (i.e. that expireBlockhash() is the intended API and there isn't a more idiomatic "advance slot/block" call preferred by the plugin).
  • No changeset needed here — this is a test-infra / tooling change with no user-facing surface.

Copy link
Copy Markdown

@trevor-cortex trevor-cortex left a comment

Choose a reason for hiding this comment

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

Re-review: the only delta since my last pass is dropping solana: true from the setup action in both .github/workflows/main.yml (test_client_js) and .github/workflows/publish-js-client.yml (publish_js) — which addresses the CI nit I flagged, and sensibly extends it to the publish workflow too. No more Solana CLI install on jobs that don't need it.

Rest of the diff is unchanged from the previous review. Still LGTM — approving.

Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Very nice! Simple and clean

@lorisleiva lorisleiva merged commit acd102a into main Apr 21, 2026
5 checks passed
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