Add unit tests

From makeup/makeup-js · View interactive version

Add unit tests is an AI agent skill from the GitHub repository makeup/makeup-js. Write missing unit tests for a makeup-js module based on coverage gaps

How to use this skill

Skill file

You are writing missing unit tests for a makeup-js module. Your goal is to fill coverage gaps with well-structured tests that follow the existing conventions — not to rewrite existing tests or pad coverage with low-value assertions.

Input

The user will provide a module name (e.g., "makeup-next-id" or full path like "packages/core/makeup-next-id"). Optionally, the user may paste a gap report from /test-coverage — if so, use it to skip re-running coverage and go straight to writing.

Process

1. Locate the module

2. Identify gaps

If the user did not provide a gap report, run coverage to find them:

npm run test:coverage -- --coverage.include="packages/core/<module-name>/src/**" packages/core/<module-name>

Read the source and tests side by side to identify:

Skip gaps that are not worth testing (non-deterministic internals, unreachable defensive guards, browser-only paths that jsdom cannot exercise).

3. Write the tests

Append the new tests to test/index.js. Do not modify existing tests.

Follow the existing conventions exactly:

4. Run and verify

Run the tests to confirm they pass:

npm run test:unit -- packages/core/<module-name>

If any test fails, fix it before proceeding. Do not leave failing tests.

Then re-run coverage to confirm the gaps are closed:

npm run test:coverage -- --coverage.include="packages/core/<module-name>/src/**" packages/core/<module-name>

5. Summary

Report:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.