Skip to content

Migrate contract tests to strict TypeScript - #191

Open
mswilkison wants to merge 2 commits into
codex/185-supported-verificationfrom
codex/5-typescript-tests
Open

mswilkison wants to merge 2 commits into
codex/185-supported-verificationfrom
codex/5-typescript-tests

Conversation

@mswilkison

@mswilkison mswilkison commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The contract tests still use JavaScript even though the Hardhat configuration and deployment scripts already use TypeScript. Migrate all 10 test suites and their shared helper to strict TypeScript with generated ethers v5 contract bindings. Contract calls, proposal arguments, signers, and transaction receipts now have concrete types, and previously implicit globals belong to their test suites.

yarn format checks TypeScript and rejects unhandled or misused promises through the existing CI job. TypeChain generates bindings during builds, type checking, and packaging. The export configuration retains the JavaScript deployment layout and excludes tests and generated bindings. The migration preserves the delegation awaits from #189. ESLint 8.57.1 supports the TypeScript lint plugin while retaining the repository's existing Keep configuration.

This PR is based on #190, which builds on #182. Retarget it to main after those prerequisites merge. It also includes the two-line fix from #189, which can merge independently.

Validation completed with Node 22.23.1 and Yarn 1.22.22:

  • All 388 tests pass; all 530 test/suite declarations match the JavaScript versions.
  • Frozen-lockfile installation and hardhat clean followed by yarn format pass, including fresh compilation, type generation, strict checking, ESLint, Solhint, and formatting.
  • Temporary checks confirm invalid contract methods and argument types fail compilation. Reintroducing the two missing awaits from Unit test failing with Expected event "DelegateVotesChanged" to be emitted, but it wasn't #111 produces exactly two no-floating-promises errors; both awaits are restored.
  • All 84 contract artifacts retain identical ABIs, creation/runtime bytecode, and link references.
  • Local Hardhat deployment and yarn prepack pass. The tarball contains all 13 JavaScript deployment modules and the verification task, with no tests or generated TypeChain files; all 13 exported deployment modules load successfully.

GitHub Actions also passed: Solidity tests, deployment dry run, and Slither, type checking, lint, and formatting, and documentation preview.

Closes #5

@mswilkison mswilkison mentioned this pull request Sep 8, 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