name: write-tests description: Write or update tape-six tests for a module or feature. Use when asked to write tests, add test coverage, or create test files.
Write Tests
Write or update tests using the tape-six testing library.
Notes
tape-sixsupports ES modules (.js,.mjs,.ts,.mts) and CommonJS (.cjs,.cts).- TypeScript is supported natively — no transpilation needed (Node 22+, Deno, Bun run
.tsfiles directly). - The default
tape6runner uses worker threads for parallel execution.tape6-seqruns sequentially in-process — useful for debugging or when tests share state.
Steps
- Read the testing guide at
node_modules/tape-six/TESTING.mdfor API reference and patterns. - Identify the module or feature to test. Read its source code to understand the public API.
- Create or update the test file in
tests/test-<name>.js(or.tsfor TypeScript,.cjsfor CommonJS):- ESM (
.js):import test from 'tape-six'and import the module under test using the project's package name. - CJS (
.cjs):const {test} = require('tape-six')andconst {...} = require('my-package'). If the module under test uses top-levelawait,require()cannot load it — useawait import('my-package')inside async tests instead. - Write one top-level
test()per logical group. - Use embedded
await t.test()for sub-cases. - Use
t.beforeEach/t.afterEachfor shared setup/teardown. - Cover: normal operation, edge cases, error conditions.
- Use
t.equalfor primitives,t.deepEqualfor objects/arrays,t.throwsfor errors,await t.rejectsfor async errors. - All
msgarguments are optional but recommended for clarity.
- ESM (
- Run the new test file directly to verify:
node tests/test-<name>.js - Run the full test suite to check for regressions:
npm test- If debugging, use
npm run test:seq(runs sequentially, easier to trace issues). - To see which files are being run, add
--flags fo(overrides the default--flags FO).
- If debugging, use
- Report results and any failures.