test: type check the test tree and fix fixture drift - #959
Merged
Conversation
Backport of the gate added on main in #954. Vitest strips types without checking them, and test/tsconfig.json only fed eslint's typed rules, so nothing ever ran tsc over test/. src/ was already covered indirectly via api:check. 21 fixtures had drifted from the library types. - add check-types (tsc over test/, which pulls src/ in through its imports), wired into prtasks, a types.yml workflow and the pre-push hook - exclude the consumer harnesses: they import the built package by its published name, so they only resolve after a build, and eslint skips them for the same reason - realign the drifted fixtures, chiefly Logger gaining log, bolt12 mint quotes having no state and onchain quotes no amount, plus two stale arguments
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v4-dev #959 +/- ##
=========================================
Coverage ? 95.48%
=========================================
Files ? 49
Lines ? 5162
Branches ? 1290
=========================================
Hits ? 4929
Misses ? 100
Partials ? 133
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
52 tasks
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.
Description
Backport of the type-check gate added on
mainin #954. Nothing has ever runtscovertest/on this line either: vitest strips types via esbuild without checking them, andtest/tsconfig.jsonexisted only to give eslint's typed rules a project covering the test tree, which catches rule violations rather than assignability.src/was covered all along, indirectly, sinceapi:checkrunsvite-plugin-dts.v4 had drifted far less than main did: 21 errors across 10 files, against main's 89 across 12. With v4 remaining the GA line until v5 ships, that seemed worth closing.
Changes
npm run check-typesrunstsc -p test/tsconfig.json. The tests import the library source directly rather than the built package, so tsc follows those imports and pulls all 81 files insrc/into the same program. One command therefore covers both trees.test/tsconfig.jsongainedrootDirandnoEmitso a baretsc -pbehaves the same on the command line as it already did in an editor.prtasks, atypes.ymlworkflow following this branch's existinglint.ymlshape (including itsactions/*@v4pins), and the pre-push hook.test/consumer/is excluded. Those harnesses deliberately import the package by its published name to simulate an external consumer, so they only resolve after a build. They are covered byconsumers.yml, which builds first, and eslint skips them for the same reason.Loggergaining alogmethod after the mock helpers were written. The rest:MintQuoteBolt12Responsehas nostateandMintQuoteOnchainResponsenoamount(both use the accounting fields), an optionalpubkeyneeding an assertion, and two stale arguments left over from older signatures, including anidempotentrequest option that exists nowhere insrc/.AGENTS.mdandCONTRIBUTING.mdupdated for the new command.Reviewer Notes
src/are touched andetc/cashu-ts.api.mdis unchanged, so there is no public API movement.log: vi.fn()crossed the print width.lib/moved aside, to simulate a clean checkout: that is exactly the case that slipped through locally on main and failed CI there, because a previous build had madetest/consumer/resolve.npm run prtaskspasses end to end: 179 test files, 6097 tests.