来源信息
- 仓库
- elastic/cli
- 最近来源活动
- 2026年9月28日 18:54
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 54
- Forks
- 31
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- test
- description
- Write and run Elastic CLI unit and functional tests.
# Test
Framework: Node.js `node:test` plus `node:assert/strict`. Files live in `test/**/*.test.ts`.
```bash
npm test
npx tsx --test test/**/*.test.ts
npx tsc --noEmit
```
`npm test` builds, then runs unit tests with coverage (90% lines/branches/functions on `src/` and `packages/*/src`, excluding generated manifests).
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.
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.
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`.
在 GitHub 查看