feat(basics): migrate 5 pilot programs from ts-mocha to tsx + node:test runner#636
feat(basics): migrate 5 pilot programs from ts-mocha to tsx + node:test runner#636NikkiAung wants to merge 3 commits into
Conversation
Greptile SummaryThis PR migrates five
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (7): Last reviewed commit: "fix(#636): remove stale mocha/chai type ..." | Re-trigger Greptile |
| "solana-bankrun": "^0.3.0", | ||
| "ts-mocha": "^10.0.0", | ||
| "typescript": "^4.3.5" | ||
| "typescript": "^5.5.0" |
There was a problem hiding this comment.
Frozen Lockfiles No Longer Match
This TypeScript range change is mirrored across many non-pilot projects without updating their local lockfiles. The CI matrices run pnpm install --frozen-lockfile inside each project, so these jobs reject the stale importer before building or testing; either revert the unrelated upgrades or regenerate every affected lockfile.
There was a problem hiding this comment.
Why is there a typescript change as well? seems like the lock files aren't generated even tho the typescript version changed
There was a problem hiding this comment.
This file — basics/account-data/native — is not one of the 5 pilot programs. The pilot for account-data is basics/account-data/pinocchio. So this TypeScript bump (^4.3.5 → ^5.5.0) appears to be a stray/unintended change that leaked into the PR.
Because no other modifications were made to this package (still using ts-mocha, chai, etc.) and the corresponding pnpm-lock.yaml for this directory wasn't regenerated, pnpm install --frozen-lockfile in CI will reject it — the lockfile's resolved TypeScript entry still reflects the old range.
The fix is simply to revert this change:
| "typescript": "^5.5.0" | |
| "typescript": "^4.3.5" |
If you do intend to bump TypeScript across non-pilot packages as a separate concern, that should be its own PR with all affected lockfiles regenerated.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
There was a problem hiding this comment.
Addressed in 5e26fde — basics/account-data/native/package.json and all 33 other non-pilot files have been reverted to main. The PR now only touches the 5 pilot programs.
There was a problem hiding this comment.
Reverted in 5e26fde — that file is back to main state and no longer part of this PR. The TypeScript bump for non-pilot packages belongs in PR #633.
81f9b32 to
b898429
Compare
|
the regenerated lockfiles dropped the libc fields on the litesvm Linux packages (they're present on main). Not breaking CI since the runners are glibc, but it can pull the wrong binary on musl/Alpine. Looks like it was regenerated with a pnpm other than the pinned 10.33.0. Can you redo them with: corepack use pnpm@10.33.0 |
b898429 to
52f74b4
Compare
|
Fixed in the latest commit. The root cause was a stale pnpm store — pnpm was reading cached metadata that omitted the Fix: |
dev-jodee
left a comment
There was a problem hiding this comment.
think all the typescript version upgrades should be removed, keep only the 5 pilot programs you mentions in the pr
| "solana-bankrun": "^0.3.0", | ||
| "ts-mocha": "^10.0.0", | ||
| "typescript": "^4.3.5" | ||
| "typescript": "^5.5.0" |
There was a problem hiding this comment.
Why is there a typescript change as well? seems like the lock files aren't generated even tho the typescript version changed
|
Fixed — reverted |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
|
@NikkiAung the 5 pilot package.jsons were fine (their lockfiles were regenerated). The problem is the other 34 package.json files in this PR (close-account, favorites, rent, realloc, transfer-sol, pda-rent-payer, program-derived-addresses, processing-instructions, repository-layout, cross-program-invocation, hello-solana/asm, create-account/asm, counter/mpl-stack, checking-accounts/native+pinocchio, account-data/native, counter/pinocchio, create-account/pinocchio, cross-program-invocation/pinocchio, plus the four outside basics/: nft-meta-data-pointer ×2, transfer-tokens/pinocchio, shank-and-solita) |
Only the 5 pilot programs should be touched in this PR: basics/hello-solana/native basics/counter/native basics/account-data/pinocchio basics/checking-accounts/asm basics/create-account/native The TypeScript version bumps in the other 34 package.json files leaked in from an earlier iteration of this branch and are being reverted here per dev-jodee's feedback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@dev-jodee Fixed — those 34 extra
17 files total (package.json + pnpm-lock.yaml + tsconfig + test files for each pilot). Nothing outside those 5 directories is touched. |
…ner (pilot)
Replaces ts-mocha with `tsx --test` as the test runner for the first 5
pilot programs, removing the dead mocha layer that was present alongside
node:test API imports.
Changes per program:
- package.json: swap `test` script to `tsx --test <file>`, drop
mocha/ts-mocha/@types/mocha/chai/@types/chai devDeps, add tsx + @types/node
- tsconfig: update `types` from ["mocha","chai"(,"node")] → ["node"]
- hello-solana/native + counter/native: convert `import { assert } from "chai"`
→ `import assert from "node:assert"` (identical truthy semantics, no call-site edits)
- pnpm-lock.yaml: regenerated per package to reflect new deps
Pilots cover every variant: both tsconfig conventions (root / tests/), both
runtimes (solana-bankrun / litesvm), all 3 CI workflows (native, pinocchio, asm),
and all assertion styles (chai convert, bare throw, node:assert already, none).
No CI workflow changes needed — tests are invoked via the `pnpm test` script
that `build-and-test` already chains into.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous lockfiles were generated with a stale pnpm store that omitted the libc field for litesvm platform packages. Regenerated using pnpm@10.33.0 with a clean store (pnpm store prune) so libc: [glibc] and libc: [musl] are correctly recorded for musl/Alpine environments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5e26fde to
4190464
Compare
…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>
…rom counter/native tsconfig counter/native has two tsconfig files; the root tsconfig.json was missed in the initial tsx migration, causing CI typecheck to fail with 'cannot find type definition for chai/mocha'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
All
basics/native/pinocchio/asm test files already importdescribe/testfromnode:test, yet they're launched throughts-mochawhich contributes nothing —node:testself-registers and auto-runs at process exit. This PR removes the dead mocha launcher and standardises the 5 pilot programs on:tsx --test <file>(matches pattern already in use atgames/world-cup/pinocchio)node:assert(dropchai)@types/nodeonly (drop@types/mocha,@types/chai)Pilot programs (5) — chosen to cover all variants
basics/hello-solana/nativechai→node:assertbasics/counter/nativechai→node:assertbasics/account-data/pinocchiobasics/checking-accounts/asmnode:assert)basics/create-account/nativeChanges per program
package.json—testscript:pnpm ts-mocha -p ... -t 1000000 <file>→tsx --test <file>; dropmocha/ts-mocha/@types/mocha/chai/@types/chai; addtsx ^4.22.0+@types/node ^22.19.1tsconfig.json—types:["mocha","chai"(,"node")]→["node"]hello-solana/native+counter/nativetest files —import { assert } from "chai"→import assert from "node:assert"(identical truthy semantics; no call-site edits)pnpm-lock.yaml— regenerated per package (mocha/chai tree removed, tsx added)No CI workflow changes needed — tests are invoked via the
pnpm testscript thatbuild-and-testalready chains into.Test plan
solana-native.ymlpasses forhello-solana/native,counter/native,create-account/nativesolana-pinocchio.ymlpasses foraccount-data/pinocchiosolana-asm.ymlpasses forchecking-accounts/asmts-mocha,"mocha", orfrom "chai"in the 5 programs