Skip to content

Commit f0af977

Browse files
authored
docs: add claude test skill (#568)
1 parent ca793bd commit f0af977

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.claude/skills/test.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: test
3+
description: Write and run Elastic CLI unit and functional tests.
4+
---
5+
6+
# Test
7+
8+
Framework: Node.js `node:test` plus `node:assert/strict`. Files live in `test/**/*.test.ts`.
9+
10+
```bash
11+
npm test
12+
npx tsx --test test/**/*.test.ts
13+
npx tsc --noEmit
14+
```
15+
16+
`npm test` builds, then runs unit tests with coverage (90% lines/branches/functions on `src/` and `packages/*/src`, excluding generated manifests).
17+
18+
Every bug fix needs a regression test that would have caught it. For URL/path/query builders, add adversarial inputs (`../`, `?#`, empty, special characters). For HTTP clients, assert the full `RequestInit` (`redirect`, `credentials`, headers), not just the response. Cover failure responses, not only success fixtures.
19+
20+
Do not weaken assertions, skip cases, or add production special cases to satisfy a bad test. The `cli.test.ts` config caching case is a known pre-existing failure; ignore only that one.
21+
22+
Functional: `ELASTIC_CLI_CONFIG_FILE` must be unset unless pointing at an intentional fixture. ES: `npm run test:functional:es`. Kibana: `ELASTIC_CLI_CONFIG_FILE=/tmp/local-rc.yml npm run test:functional:kb`. Cloud: `npm run test:functional:cloud`.

0 commit comments

Comments
 (0)