Skip to content

test(cli): add vitest test foundation for apps/cli - #353

Merged
yupix merged 6 commits into
mainfrom
test/cli-vitest-foundation
Jul 15, 2026
Merged

test(cli): add vitest test foundation for apps/cli#353
yupix merged 6 commits into
mainfrom
test/cli-vitest-foundation

Conversation

@sousuke0422

@sousuke0422 sousuke0422 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

概要

apps/cli@koyori/task-cli・6 コマンド: auth/config/my/projects/sprints/tasks)に vitest テスト基盤を導入し、CI で実走させる。現状の正しい挙動をゴールデン固定する安全網。#237(ESM 移行)・#235(commander v15)の前提工事

スコープ

チェックリスト

  • vitest 設定・test script 追加
  • config/store(一時ディレクトリ・実ファイル破壊なし)
  • api/pathsapi/client(openapi-fetch モック)
  • commands 6 種の引数パース・分岐 smoke
  • utils(output/errors/projects/statuses/command)ユニット
  • CLI エントリ(bin/task.jsindex.ts)起動 smoke
  • CI ワークフロー cli-test.yml 新設(pull_request で回る・40桁 SHA ピン留め)
  • CI で 23 tests 緑・SKIP 0 を実証(run 29406072277 success・本 PR の主眼=偽緑排除を達成)

コミット

  • f8dfccd1 — cli-test.yml 新設(pull_request/push(main)・40桁 SHA 固定)
  • 25fb4747 — pnpm version の明示 pin(CI 緑化)

Closes #352

Assisted-by: multi-agent-shogun-aki-tweak

Assisted-by: multi-agent-shogun-aki-tweak
@github-actions

Copy link
Copy Markdown

前回のレビューから新たな問題は見つかりませんでした。

全テストファイル(6ファイル・23テスト)をソースコードと突き合わせて確認しましたが、以下の点はすべて適切です:

  • vitest.config.ts の設定(clearMocks/restoreMocks、include パターン)
  • tsconfig.jsonexclude: ["src/**/__tests__"] でビルド产物にテストを含まない
  • package.json"test": "pnpm run build && vitest run"entry.test.tsdist/index.js 経由の bin/task.js を叩くためビルド前置が必要)
  • 各テストのモックとアサーションがソースの実際の挙動と一致している
  • store.test.ts の一時ディレクトリ利用とクリーンアップ
  • client.test.ts のシングルトンキャッシュ検証
  • paths.test.ts の型レベル契約テスト

New%20session%20-%202026-07-15T09%3A18%3A52.307Z
opencode session  |  github run

Assisted-by: multi-agent-shogun-aki-tweak
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploying koyori with  Cloudflare Pages  Cloudflare Pages

Latest commit: 60238b7
Status: ✅  Deploy successful!
Preview URL: https://0b4540e0.koyori.pages.dev
Branch Preview URL: https://test-cli-vitest-foundation.koyori.pages.dev

View logs

Assisted-by: multi-agent-shogun-aki-tweak
@sousuke0422
sousuke0422 marked this pull request as ready for review July 15, 2026 09:59
@github-actions

Copy link
Copy Markdown

前回のレビューで「全テストファイル・23テストをソースコードと突き合わせて確認し、問題なし」と判断済みです。

前回のレビューから新たな問題は見つかりませんでした。

New%20session%20-%202026-07-15T09%3A59%3A26.896Z
opencode session  |  github run

Add tsconfig.test.json (noEmit, includes __tests__) and run tsc in
cli-test.yml so expectTypeOf contract tests fail CI on type mismatch.

Assisted-by: multi-agent-shogun-aki-tweak
Add paths.test.ts comment that CI typecheck:test enforces expectTypeOf
contracts; globalSetup builds dist when missing; relax os mock tmpdir
hardcoding and entry stderr strict match.

Assisted-by: multi-agent-shogun-aki-tweak
Compare src/tsconfig mtimes against dist before skipping the vitest build
step so direct vitest runs cannot pass against stale compiled output.
Rename entry it.each titles to match --help rendering behavior.

Assisted-by: multi-agent-shogun-aki-tweak
@yupix
yupix merged commit 7d9e160 into main Jul 15, 2026
2 checks passed
@yupix
yupix deleted the test/cli-vitest-foundation branch July 15, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cli): apps/cli に vitest テスト基盤を導入する

2 participants