chore(test): vitest harness, typecheck and test scripts (CLI-00) - #11
Merged
Merged
Conversation
Nothing in this repo could be verified: package.json had only build, dev and prepack, so the gate's standard check proved the code compiles and no more. - `typecheck` runs tsc --noEmit over a typecheck-only project at tests/tsconfig.json, which extends the root config and widens rootDir to the repo so src/, tests/ and vitest.config.ts are all checked. The root tsconfig.json is untouched, so `build` and `prepack` still emit dist/ from src/ alone and dist/ contains no tests. - `test` runs vitest once; `test:watch` watches. - vitest is the only new dependency and it is a devDependency. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Reference tests for the pure modules, one file per module, all offline: no test imports getMento, reaches an RPC or constructs a wallet. - format: formatAddress truncation and its cutoff, parseAmount at 18 and 6 decimals with fractional truncation, formatTokenAmount separators and displayDecimals. - client: resolveChainId for both names, casing, numeric IDs and the unknown chain error. - errors: handleError's message classes and the default, with process.exit and console.error stubbed. parseAmount's handling of a non-numeric amount is recorded as it behaves today, not as it should behave; fixing it is CLI-02. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
bayological
marked this pull request as ready for review
September 22, 2026 20:47
bayological
added a commit
that referenced
this pull request
Sep 22, 2026
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.
What
Makes the gate able to judge work. Before this,
package.jsonhad onlybuild,devandprepack, no test runner and no tests, so.skein/config.json's standard check proved thecode compiles and nothing more.
typecheck(tsc --noEmit -p tests/tsconfig.json),test(vitest run),test:watch(vitest).vitestas the only new dependency, a devDependency.tests/tsconfig.json— a typecheck-only project extending the root config, wideningrootDirto the repo sosrc/,tests/andvitest.config.tsare all checked. The roottsconfig.jsonis unchanged, sobuildandprepackstill emitdist/fromsrc/alone;
dist/contains notests/. It lives undertests/because CLI-00 ownstests/**and not a new root file.tests/format.test.ts,tests/client.test.ts,tests/errors.test.ts. Suite runs in under a second.No product behaviour changes. Nothing under
src/is touched.Offline by construction
No test imports
getMento, reaches an RPC, or constructs a wallet (AGENTS.md P1, P2). Theonly SDK import is
ChainId, soresolveChainId's expectations come from the SDK ratherthan from memory (P3).
Left alone deliberately
parseAmounthands its input straight toBigInt().tests/format.test.tsrecords today'sbehaviour for
"abc"(a rawSyntaxError, whichhandleErrorthen prints verbatim) ratherthan asserting the behaviour it should have. Fixing that is CLI-02.
Gate
🤖 Generated with Claude Code
Note
Overview
Introduces a Vitest test harness so CI and local gates can run automated checks beyond compile-only validation.
package.jsongainstypecheck(tsc --noEmitviatests/tsconfig.json),test, andtest:watch, withvitestas the sole new devDependency.tests/tsconfig.jsonextends the root config but widens scope tosrc/,tests/, andvitest.config.tswithout changingbuild/prepack(still emitdist/fromsrc/only).vitest.config.tsruns tests in Node and inlines@mento-protocol/mento-sdkso extensionless ESM imports resolve under Vite.Adds 38 unit tests for pure helpers:
resolveChainIdinclient,handleErrormessaging (with mockedprocess.exit), andformatAddress/parseAmount/formatTokenAmount. Tests stay offline—no RPC, wallets, orgetMento.src/is unchanged.Reviewed by Cursor Bugbot for commit 00cd040. Bugbot is set up for automated code reviews on this repo. Configure here.