Skip to content

chore(test): vitest harness, typecheck and test scripts (CLI-00) - #11

Merged
bayological merged 2 commits into
mainfrom
chore/test-harness-cli-00
Sep 22, 2026
Merged

bayological merged 2 commits into
mainfrom
chore/test-harness-cli-00

Conversation

@bayological

@bayological bayological commented Sep 22, 2026

Copy link
Copy Markdown
Member

What

Makes the gate able to judge work. Before this, package.json had only build, dev and
prepack, no test runner and no tests, so .skein/config.json's standard check proved the
code compiles and nothing more.

  • Scripts: typecheck (tsc --noEmit -p tests/tsconfig.json), test (vitest run),
    test:watch (vitest).
  • vitest as the only new dependency, a devDependency.
  • tests/tsconfig.json — a typecheck-only project extending the root config, widening
    rootDir to the repo so src/, tests/ and vitest.config.ts are all checked. The root
    tsconfig.json is unchanged, so build and prepack still emit dist/ from src/
    alone; dist/ contains no tests/. It lives under tests/ because CLI-00 owns
    tests/** and not a new root file.
  • 38 tests over the pure modules: 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). The
only SDK import is ChainId, so resolveChainId's expectations come from the SDK rather
than from memory (P3).

Left alone deliberately

parseAmount hands its input straight to BigInt(). tests/format.test.ts records today's
behaviour for "abc" (a raw SyntaxError, which handleError then prints verbatim) rather
than asserting the behaviour it should have. Fixing that is CLI-02.

Gate

SKEIN_GATE_RESULT task=CLI-00 base=origin/main status=PASS checks=brief:PASS,clean-tree:PASS,boundary:PASS,secrets:PASS,test-integrity:PASS,invariants:PASS,standard:PASS,e2e:PASS,accept:PASS

🤖 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.json gains typecheck (tsc --noEmit via tests/tsconfig.json), test, and test:watch, with vitest as the sole new devDependency.

tests/tsconfig.json extends the root config but widens scope to src/, tests/, and vitest.config.ts without changing build/prepack (still emit dist/ from src/ only). vitest.config.ts runs tests in Node and inlines @mento-protocol/mento-sdk so extensionless ESM imports resolve under Vite.

Adds 38 unit tests for pure helpers: resolveChainId in client, handleError messaging (with mocked process.exit), and formatAddress / parseAmount / formatTokenAmount. Tests stay offline—no RPC, wallets, or getMento. src/ is unchanged.

Reviewed by Cursor Bugbot for commit 00cd040. Bugbot is set up for automated code reviews on this repo. Configure here.

bayological and others added 2 commits September 22, 2026 15:45
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>
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f6c9fea9-a870-46b2-8e45-d74835a2824a

📥 Commits

Reviewing files that changed from the base of the PR and between fdb0456 and 00cd040.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • package.json
  • tests/client.test.ts
  • tests/errors.test.ts
  • tests/format.test.ts
  • tests/tsconfig.json
  • vitest.config.ts
 _________________________
< I am the bug whisperer. >
 -------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@bayological
bayological marked this pull request as ready for review September 22, 2026 20:47
@bayological
bayological merged commit 7de3b31 into main Sep 22, 2026
3 checks passed
@bayological
bayological deleted the chore/test-harness-cli-00 branch September 22, 2026 20:47
bayological added a commit that referenced this pull request Sep 22, 2026
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.

1 participant