datadog/write-tests
Write tests for datadog-ci commands and helpers using established repository patterns.
npx skills add https://github.com/DataDog/datadog-ci --skill write-tests
Write tests for datadog-ci commands and helpers following the repo's established patterns. Before writing tests, read existing tests in the same package to match local patterns.
__tests__/*.test.ts next to the source, fixtures in __tests__/fixtures/From packages/base/src/helpers/__tests__/testing-tools.ts:
createMockContext(opts?) -- creates a mock context with stdout and stderr writable streams. Use context.stdout.toString() / context.stderr.toString() to check output.makeRunCLI(commandClass, baseArgs, opts?) -- returns an async function (extraArgs, extraEnv?) => {context, code} that registers and runs a command through the full CLI pipeline.createCommand(commandClass, context?) -- instantiates a command with mock context and resolved option defaults. Good for unit-testing command methods directly.MOCK_DATADOG_API_KEY, MOCK_BASE_URL -- standard mock values.getRequestError(status, {errors?, message?}) -- creates a mock RequestError.jest.spyOn() for mocking, restore in afterEach or use jest.restoreAllMocks()jest.mock() for module-level mocks when neededdescribe.each / test.each where appropriatefetch)yarn test # all tests
yarn test <path> # specific package or file
yarn test --testPathPattern # regex match
Take datadog/write-tests from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.