Skip to content

✅ : bindTestingPiniaのテスト追加 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 15, 2025

Conversation

XeicuLy
Copy link
Owner

@XeicuLy XeicuLy commented Mar 15, 2025

この PR には、テスト設定とワークフローの構成に関するいくつかの変更が含まれています。最も重要な変更点は、CI ワークフローへの Vitest の追加、bindTestingPinia ヘルパーの新しいテストの作成、および Vitest を使用するための bindTestingPinia 実装の更新です。

ワークフロー構成:

  • .github/workflows/quality-check.yml: Vitest を実行する新しいジョブを追加し、ビルドジョブが Vitest ジョブに依存するように更新しました。

Testing:

ISSUE

close #21

Summary by CodeRabbit

  • Chores

    • CI/CDパイプラインに新たなeslintジョブを追加し、ビルドプロセスの信頼性向上を図りました。
    • 既存のeslintジョブをvitestに名称変更し、依存関係を更新しました。
  • Tests

    • bindTestingPiniaヘルパーの機能を検証する新しいテストファイルを追加し、モック機能を強化することでテストの正確性を向上させました。

@XeicuLy XeicuLy self-assigned this Mar 15, 2025
Copy link

coderabbitai bot commented Mar 15, 2025

Walkthrough

このプルリクエストでは、GitHub Actions のワークフローに新たに eslint ジョブを追加し、既存の eslint ジョブを vitest に名前変更しました。vitest ジョブは、type-checkeslintprettier の各ジョブの成功を依存関係として持つようになり、build ジョブもこれらに加えて vitest の成功を依存関係として持つように更新されました。また、Pinia ストアのテスト補助機能である bindTestingPinia の動作検証用テストファイルが追加され、実装側では Vitest のモック機能を利用するための createSpy プロパティが導入されています。

Changes

File(s) Change Summary
.github/workflows/quality-check.yml eslint ジョブを新規追加(pnpm ci:eslint の実行)、及び eslint ジョブを vitest に名前変更、依存関係の更新(vitestbuild
src/__test__/helpers/bindTestingPinia.spec.ts
src/helpers/test/bindTestingPinia.ts
新たに Pinia のテストを検証するテストファイルを追加
bindTestingPinia の設定に vi のモック関数 (createSpy) を追加しテスト支援機能を強化

Sequence Diagram(s)

sequenceDiagram
    participant WF as GitHub Workflow
    participant QC as Quality Checks (type-check, prettier, eslint)
    participant VT as Vitest Job
    participant B as Build Job

    WF->>QC: 各種品質チェック開始
    QC-->>WF: 結果返却
    WF->>VT: Vitest ジョブ開始 (pnpm ci:vitest)
    VT-->>WF: テスト結果返却
    WF->>B: Build ジョブ開始(依存: QC + VT)
Loading

Possibly related PRs

  • 型チェックを追加 #22: type-check ジョブ追加に関する変更と共通のワークフロー依存関係の改修が類似している。
  • Vitestの設定 #19: ESLint の Vitest 対応設定の変更と、Vitest を利用する本変更が密接なコードレベルの関連を持つ。
  • ESLintを設定する #17: eslint ジョブの追加と変更が同じワークフローに関するもので、直接的な関連がある。

Poem

うさぎがぴょんぴょん
コードの森を駆け抜けるよ🐰
Vitestの風がそよぎ
ビルドの鐘が響く
小さなテストの芽が咲く
明日へ跳ねる、夢のステップ!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55c7a6a and ccd9aef.

📒 Files selected for processing (1)
  • .github/workflows/quality-check.yml (3 hunks)
🔇 Additional comments (3)
.github/workflows/quality-check.yml (3)

36-51: ESLintジョブの追加の確認
新規追加されたESLintジョブは、type-checkジョブに依存し、正しくソースコードのチェックアウト、依存関係のインストール、そしてpnpm ci:eslintの実行が設定されています。設定内容は問題なく、ESLintによる静的解析が確実に実施されるようになっています。


68-83: Vitestジョブの設定更新の確認
Vitestジョブは、[type-check, eslint, prettier]に依存する形でセットアップされ、ソースコードのチェックアウト、Node.js環境のセットアップ、およびpnpm ci:vitestコマンドによってテストが実行されるようになっています。Vitestを利用したテスト実行として適切に反映されています。


86-87: Buildジョブの依存関係更新の確認
Buildジョブのneedsvitestが追加され、これまでのtype-check, eslint, prettierに加え、テスト実行が成功した後にビルドが実行されるようになっています。全体のワークフローの品質管理が向上しており、変更内容は適切です。


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot added the 開発環境 開発環境の構築に関連する label Mar 15, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31d9a8c and 55c7a6a.

📒 Files selected for processing (3)
  • .github/workflows/quality-check.yml (1 hunks)
  • src/__test__/helpers/bindTestingPinia.spec.ts (1 hunks)
  • src/helpers/test/bindTestingPinia.ts (2 hunks)
🔇 Additional comments (7)
src/helpers/test/bindTestingPinia.ts (2)

1-2: Vitestのインポートが適切に追加されています

テスト環境でのモック関数を作成するために必要なviモジュールが正しくインポートされています。


12-15: createSpyプロパティの追加は適切です

createTestingPiniaの設定オブジェクトにcreateSpy: vi.fnを追加することで、Vitestのモック機能が統合されました。これにより、テスト時にストアのアクションやゲッターをスパイできるようになります。

.github/workflows/quality-check.yml (2)

68-83: Vitestジョブの追加は適切です

CI/CDパイプラインにVitestジョブを追加することで、プルリクエスト時に自動的にテストが実行されるようになりました。設定内容も適切です。


84-86: buildジョブの依存関係が適切に更新されています

buildジョブがvitestジョブに依存するように更新されており、テストが成功した場合のみビルドが実行されるようになっています。これは適切な変更です。

src/__test__/helpers/bindTestingPinia.spec.ts (3)

4-18: テスト用ストアの定義は適切です

テスト用のストアが適切に定義されており、ステートとアクションが含まれています。これはテストに必要な機能をカバーしています。


19-34: 空のinitialStateでのテストケースは適切です

空のinitialStateでPiniaインスタンスを作成するテストケースが適切に実装されています。インスタンスの存在確認、初期値の検証、アクション実行後の状態変化の確認など、必要なテスト項目がカバーされています。


35-55: 初期状態を指定したテストケースも適切です

初期状態を持つPiniaインスタンスを作成するテストケースも適切に実装されています。指定した初期値が正しく反映されていることと、アクション実行後の状態変化が期待通りであることを確認しています。

@XeicuLy XeicuLy merged commit aee5a2c into main Mar 15, 2025
8 checks passed
@XeicuLy XeicuLy deleted the feature/add-bind-testing-pinia-test branch March 15, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
開発環境 開発環境の構築に関連する
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub Actionsにテストのステップを追加する
1 participant