traPtitech / traPtitech/Checkin

Vue の単一ファイルコンポーネントをテストする手段を用意する

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
3d 5h
Merged PRs (30d)
7

Description

現状

.vue の描画を確かめる手段がこのリポジトリに無い。2026-09-18 に feat/merge-auth-collectiond8feaca で確かめたところ、次のとおりだった。

  • @vue/test-utils@nuxt/test-utilshappy-domjsdom@testing-library/vue@vitejs/plugin-vue のいずれも、リポジトリのルートと apps/webnode_modules に存在しない。
  • ルートの vitest.config.tsinclude['{apps,packages}/*/**/*.test.ts'] で、.vue を対象にしていない。

このため、表示条件の分岐や日時の書式のように、テンプレートの中で決まるものは型の検査でしか確かめられない。現状は、導出を apps/web/app/composables/ の関数へ切り出して純粋関数としてテストする形で迂回している(useListPagination.ts がその例)。

誰が何を誤るか

画面の分岐を変える人が、変更が描画に及ぼす影響をテストで確かめられない。切り出しで迂回できるのは導出だけで、テンプレートの v-if の条件やスロットの受け渡しはこの方法では確かめられないため、その部分の回帰は手で画面を開くまで出ない。

決めること

  • 描画をテストする手段を入れるか、切り出しによる迂回を方針として明文化するか。
  • 入れる場合、DOM の実装(happy-domjsdom)と、Nuxt の自動 import・コンポーネント解決をどう与えるか(@nuxt/test-utils を使うか、@vitejs/plugin-vue と手動のスタブで足りるか)。
  • vitest.config.tsinclude と環境の設定を、既存の *.test.ts の実行を遅くしない形にできるか。

直さずに残した理由

依存を足す判断で、実行時間と保守の負担が増える。描画のテストが要るかどうかは、上に挙げた「切り出しで迂回する」方針を続けるかどうかの判断と一体になっている。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the root vitest.config.ts and apps/web/app/composables/useListPagination.ts, then inspect how existing *.test.ts files are run. Compare the repository's need for .vue rendering checks with the proposed extraction-based workaround and the listed test dependencies. Done means the project has a decided, documented testing approach and the relevant configuration or policy is in place.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.