feat(basics): migrate remaining 29 programs from ts-mocha to tsx + node:test runner#637
Open
NikkiAung wants to merge 1 commit into
Open
feat(basics): migrate remaining 29 programs from ts-mocha to tsx + node:test runner#637NikkiAung wants to merge 1 commit into
NikkiAung wants to merge 1 commit into
Conversation
…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>
Greptile SummaryThis PR migrates the remaining non-Anchor basics tests to Node’s built-in test runner. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "feat(basics): migrate remaining 29 progr..." | Re-trigger Greptile |
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