test-from-target
Installation
SKILL.md
Test from target (class or method)
Given a target (class or class.method), an optional source file path, and a test file path, produce or update a Mocha-style test suite (TypeScript .test.ts) aligned with project patterns. Focus on full logical branch coverage, validation, and error propagation. Source lives under src/; tests run with npm test or npm run test:all (Mocha + --require tsx/cjs).
Input parameters
Supply as ordered lines (one per line, no prefixes):
- TARGET_NAME (${targetCode}) — Fully qualified target to test: Class or Class.method. Examples:
UsersModel.getActiveUsers,AuthController.login. Use the real method name (no__prefix); controllers expose private methods without__. - TEST_FILE_PATH (${testFile}) — Repo-relative path to the test file to create or update (must end with
.test.ts). - (Optional) SOURCE_FILE_PATH (${sourceFile}) — Repo-relative path to the implementation file (e.g.
src/controllers/auth.controller.ts) for context and import resolution.
Example:
AuthController.login
test/controllers/auth.controller.test.ts
src/controllers/auth.controller.ts