| name | write-smoke-test |
| description | Add or update smoke tests that validate build output and content integrity for this project. |
write-smoke-test Skill
Purpose:
Add or update smoke tests to validate build and content integrity.
When to Use:
- When changing build scripts, content structure, or adding new features.
- When fixing bugs related to build or content output.
Instructions:
- Place smoke tests in
scripts/test.ts.
- Use Node.js and TypeScript for test scripts.
- Test for existence and validity of key output files (e.g.,
dist/content/categories.json).
- Validate JSON structure and required fields.
- Print clear error messages and exit with non-zero code on failure.
- Run
npm test to execute all smoke tests.
Code Example:
import { promises as fs } from "fs";
async function main() {
const categories = JSON.parse(await fs.readFile("dist/content/categories.json", "utf8"));
if (!Array.isArray(categories)) throw new Error("categories.json is not an array");
}
main().catch(e => { console.error(e); process.exit(1); });
Related Files:
scripts/test.ts
dist/content/