Consolidate test harness helpers and replace global stdout/stderr patching
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- nodejs, typescript
- 領域
- testing
調査の方向性
Start with the duplicated helpers the issue lists: test/es/helpers/bulk-ingest.test.ts, watch.test.ts, scroll-search.test.ts and msearch.test.ts, plus test/factory.test.ts and test/config/text-output.test.ts. Run rg -n 'process\.(stdout|stderr)\.write = ' test to confirm the baseline. Done means one shared capture and transport helper under test/helpers/ that uses t.mock.method, with the grep returning 0 and npm test passing. The helper signatures differ between files, so decide on a shared signature with the maintainers before migrating.
索引モデルが issue の本文から書いたものです。
説明
Problem
Tests patch global streams by hand and copy the same harness helpers between files.
- Global stream patching.
rg -n 'process\.(stdout|stderr)\.write = ' testfinds 82 assignments in 19 files (rg -l ... | wc -l). Examples:test/config/text-output.test.ts,test/config/loader.test.ts,test/docs/chat.test.ts:138-158. If a test skips its restore, runner output is lost and later tests see the stub. - Duplicated helpers (
rg -n 'function <name>\b|const <name>\b' test):mockTransport: 4 files (test/es/helpers/{bulk-ingest,scroll-search,watch,msearch}.test.ts)makeDeps: 5 files (the four above plustest/es/handler.test.ts:40)runCommand: 4;captureOutput: 4 in 3 files;captureStdout: 2 (test/factory.test.ts:2059,2364,4188,test/es/search-schema.test.ts:33,test/es/helpers/watch.test.ts:49)makeClient: 4 in 2 files (test/lib/es-client.test.ts,test/lib/kibana-client.test.ts)mkdtemp: 24 files.ELASTIC_CLI_CONFIG_FILEused: 9 files.
The copies have different signatures:
bulk-ingest.test.ts:18mockTransport(responses: Array<{ errors: boolean, items: ... }>)vswatch.test.ts:32mockTransport(responses: MockResponse[])factory.test.ts:2059captureOutput(fn: () => Promise<void>)vswatch.test.ts:49captureOutput()(takes no arguments and returns a sink)
Note: test/docs/chat.test.ts patches process.stderr.write on purpose. The test checks that the chat loop never writes to the real stderr (assert.deepEqual(realWrites, [])). It does not show a bypass in src/docs/*.
Proposal
Add test/helpers/{capture,transport,tmp-config}.ts. capture(t) uses t.mock.method(process.stdout, 'write', ...), which node:test restores automatically. Migrate in small PRs: the four test/es/helpers tests first, then factory.test.ts. Keep the chat.test.ts guard, but switch it to t.mock.method.
Acceptance criteria
-
rg 'process\.(stdout|stderr)\.write = ' testreturns 0 matches - Only one
mockTransport/captureOutputdefinition exists, intest/helpers/ - Temporary config setup (
mkdtemp+ELASTIC_CLI_CONFIG_FILE) goes through one helper with automatic cleanup -
npm testpasses on all supported Node versions
Related: #733 (DI for _test* seams).
authored by Pi Coding Agent (Claude Opus 5.5)
- 主要言語
- TypeScript
- スター
- 47
- フォーク
- 27
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 52
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
elastic/cli のほかの issue
-
feat: ship skills/elastic/SKILL.md for agent invocation対応中かも @onatozmenn が 15 日前に担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 20/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
apache/rocketmq-dashboard#6610 ·
メンテナーはふだん 3 日以内に返信
-
nextjs-tracking
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
cloudflare/vinext#3920 ·
メンテナーはふだん 1 日以内に返信
-
Team:Dashboards
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
elastic/kibana#297299 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
analytics beginner friendly community contributions-welcome good first issue hacktoberfest help wanted up-for-grabs
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
affected/v17 affected/v18 area/frontend type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
umbraco/Umbraco-CMS#24186 ·
メンテナーはふだん 2 日以内に返信