feat(basics): migrate remaining 29 programs from ts-mocha to tsx + node:test runner#637
Open
NikkiAung wants to merge 3 commits into
Open
feat(basics): migrate remaining 29 programs from ts-mocha to tsx + node:test runner#637NikkiAung wants to merge 3 commits into
NikkiAung wants to merge 3 commits into
Conversation
Greptile SummaryThis PR moves the remaining non-Anchor
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(#637): remove stale mocha/chai types..." | Re-trigger Greptile |
…de:test runner Follow-up to the 5-program pilot (PR solana-foundation#636). Applies the same pattern to all remaining non-anchor native/pinocchio/asm programs in basics/: - package.json: test script → `tsx --test <file>`; drop mocha/ts-mocha/ @types/mocha/chai/@types/chai; add tsx ^4.22.0 + @types/node ^22.19.1 - tsconfig.json (or tests/tsconfig.test.json): types → ["node"] - pnpm-lock.yaml: regenerated per package 6 test files also needed structural edits: - cross-program-invocation/native + pinocchio: add `node:test` imports; rename it() → test() - hello-solana/asm + pinocchio: add node:test imports; rename it() → test(); convert chai import to node:assert - favorites/native: change mocha import → node:test; chai → node:assert; convert expect().to.equal/deep.equal → assert.strictEqual/deepStrictEqual; add beforeEach to node:test import - favorites/pinocchio: change mocha import → node:test (stub file) Anchor programs are intentionally excluded: anchor test uses mocha internally via `anchor test --validator legacy`, bypassing package.json scripts entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NikkiAung
force-pushed
the
feat/node-test-runner-all
branch
from
July 25, 2026 00:35
bc92a78 to
f467b24
Compare
…igs, fix create-account/asm es6 target The CI overhaul added tsc --noEmit checks which caught: 1. Root tsconfig.json files with types:["mocha","chai","node"] - mocha/chai no longer installed (replaced by tsx migration), causing typecheck failure. 2. create-account/asm/tsconfig.json had target:"es6" but test uses BigInt literals which require ES2020. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ode compatibility Programs that use CPI to the system program fail in solana-bankrun 0.3.x because its bundled system-program binary emits SBPF v2 instructions that bankrun's own VM cannot execute. Switch the 5 affected programs to litesvm (synchronous API, before() setup hook) to fix CI. Programs fixed: - basics/account-data/native - basics/close-account/native - basics/pda-rent-payer/native - basics/program-derived-addresses/native - basics/rent/native Also adds skipLibCheck: true to tsconfigs missing it, and bumps TypeScript to ^5.5.0 to match the rest of the PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Too many files changed for review. ( Bypass the limit by tagging |
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
Follow-up to #636 (pilot). Applies the same ts-mocha →
tsx --testmigration to all remaining non-anchor native/pinocchio/asm programs inbasics/(29 programs, 94 files).Anchor programs excluded —
anchor test --validator legacyinvokes mocha internally and bypassespackage.jsonscripts entirely; migrating them requires changes to the Anchor CLI itself.Changes per program (×29)
package.json—testscript:pnpm ts-mocha … <file>→tsx --test <file>; dropmocha/ts-mocha/@types/mocha/chai/@types/chai; addtsx ^4.22.0+@types/node ^22.19.1tsconfig.json—types: drop"mocha"and"chai", ensure"node"is presentpnpm-lock.yaml— regenerated per package (mocha/chai tree removed, tsx added)6 test files with structural edits
cross-program-invocation/nativenode:testimports (before,describe,test); renameit()→test()cross-program-invocation/pinocchioimport { assert } from "chai"→import assert from "node:assert"hello-solana/asmnode:testimports (before,describe,test); renameit()→test(); chai → node:asserthello-solana/pinocchiofavorites/nativeimport { describe, test } from "mocha"→node:test; addbeforeEach; chai → node:assert;expect().to.equal→assert.strictEqual,expect().to.deep.equal→assert.deepStrictEqualfavorites/pinocchioimport { describe } from "mocha"→node:test(stub file)Note:
favorites/nativeandcross-program-invocation/nativeremain in.ghaignore— migrations are for correctness/consistency, not yet CI-verified.Test plan
solana-native.ymlpasses for all native programs in this PRsolana-pinocchio.ymlpasses for all pinocchio programssolana-asm.ymlpasses forcreate-account/asmandtransfer-sol/asmts-mocha,from "mocha", orfrom "chai"in migrated programs