All skills
migrate-to-shoehorn
Replace `as` type assertions in test files with type-safe @total-typescript/shoehorn helpers.
- Part of mattpocock/skills
- 550k installs
- Developer Tools · Testing and debugging
When to use it
Your test files are cluttered with `as` or `as unknown as` casts to fake large objects, and you want to pass only the fields each test needs.
For example
You say
Use migrate-to-shoehorn to convert the `as Request` casts in getUser.test.ts to fromPartial so I only pass body.id.
You get
- Updated test file
- fromPartial imports added
- Type check passes
How it works
- `as unknown as Type` becomes `fromAny()` for intentionally wrong data.
- `fromExact()` forces a full object you can loosen to `fromPartial()` later.
Before installing
Requires installing the @total-typescript/shoehorn npm package; it is meant for test code only, never production code.
More Testing and debugging skills
See all- systematic-debugging343kInvestigates bugs, test failures and unexpected behavior methodically before proposing any fix.
- test-driven-development288kWrites tests before implementation code when building any feature or bugfix.
- webapp-testing211kTests local web apps with Playwright, checking frontend behavior, capturing screenshots and reading browser logs.
- golang-testing46.4kWrites Go tests with table-driven cases, fuzzing, coverage and goroutine leak checks.
Also in this pack
- grill-me1.6MInterviews you relentlessly to sharpen a plan or design before you commit to it.
- grill-with-docs1.4MInterviews you hard about a plan while also writing decision records and a glossary as you go.
- improve-codebase-architecture1.3MScans a codebase for structural improvement opportunities, shows them in an HTML report, then digs into your pick.
- tdd1.3MBuilds features and fixes bugs test-first, writing failing tests before code and refactoring after.