テスト構造ドキュメント
概要
| 項目 | 値 |
|---|---|
| テストフレームワーク | Vitest |
| 実行環境 | jsdom (ブラウザ環境シミュレート) |
| テストファイル数 | 81 ファイル |
| describe ブロック数 | 503 |
| test/it ブロック数 | 947 |
| カバレッジ閾値 | lines/functions/branches/statements すべて 60% |
テスト実行コマンド
bash
yarn test # Vitest (watch mode)
yarn test:unit # Unit テスト一括実行
yarn test:ci # CI用 (型チェック + カバレッジ付き)
yarn coverage # カバレッジレポート生成設定ファイル
vitest.config.ts
| 設定 | 値 |
|---|---|
| environment | jsdom |
| globals | true |
| setupFiles | ./vitest.setup.ts |
| pool | threads |
| singleThread | true |
| maxConcurrency | 1 |
| testTimeout | 30000ms |
| coverage provider | v8 |
| coverage reporter | text, lcov, html, json-summary |
テスト対象パス (include)
src/**/*.{test,spec}.{ts,tsx,js,jsx}electron/**/__tests__/*.{test,spec}.{ts,tsx,js,jsx}electron/__tests__/*.{test,spec}.{ts,tsx,js,jsx}src/**/__tests__/*.{test,spec}.{ts,tsx,js,jsx}
除外パス (exclude)
electron-dist/**,node_modules/**,dist/**,release/**
モック設定
| エイリアス | 対象 |
|---|---|
*/imageImports | src/utils/__mocks__/imageImports.ts |
グローバルセットアップ (vitest.setup.ts)
@testing-library/jest-domのインポートlocalStorageモックの定義・グローバル設定window.electronAPIの初期化 (undefined)
テストファイル配置規則
- テスト対象のソースファイルと同じディレクトリに
__tests__/フォルダを配置 - またはソースファイルと同階層に
<filename>.test.ts(x)を配置 - 拡張子:
.test.ts,.test.tsx,.spec.ts,.spec.tsx
ディレクトリ別テスト一覧
electron/
electron/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
database.test.ts | 44 | 14 | データベース基本操作 |
logger.test.ts | 23 | 8 | ロガーユーティリティ |
main_utils.test.ts | 3 | 2 | メインプロセスユーティリティ |
electron/database/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
DatabaseConnection.test.ts | 37 | 16 | DB接続管理 |
StatsService.test.ts | 46 | 10 | 統計サービス |
electron/ipc/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
DatabaseAdminHandlers.test.ts | 10 | 1 | DB管理IPCハンドラー |
MatchHandlers.test.ts | 14 | 1 | 試合データIPCハンドラー |
ProfileHandlers.test.ts | 8 | 1 | プロファイルIPCハンドラー |
SeasonHandlers.test.ts | 9 | 1 | シーズンIPCハンドラー |
StatsHandlers.test.ts | 12 | 1 | 統計IPCハンドラー |
electron/services/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
LogWatcherService.test.ts | 3 | 1 | ログ監視サービス |
ResponseStorageService.test.ts | 11 | 7 | レスポンス保存サービス |
UserSettingsService.test.ts | 6 | 3 | ユーザー設定サービス |
electron/windows/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
WindowStateStore.test.ts | 6 | 1 | ウィンドウ状態管理 |
src/components/common/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
TabErrorBoundary.test.tsx | 1 | 6 | タブエラーバウンダリ |
src/components/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useAssistPanels.test.ts | 1 | 9 | アシストパネル制御 |
useStartupImport.test.ts | 1 | 9 | スタートアップインポート |
src/components/tabs/browser-automation/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useBrowserAutomationState.test.ts | 1 | 12 | ブラウザ自動化状態管理 |
src/components/tabs/common/components/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
ContextGuidePanel.test.tsx | 1 | 2 | コンテキストガイドパネル |
OperationalChecklistPanel.test.tsx | 1 | 2 | 運用チェックリストパネル |
ProfileManagerView.test.tsx | 5 | 25 | プロファイル管理ビュー |
WorkflowProgressPanel.test.tsx | 1 | 2 | ワークフロー進捗パネル |
src/components/tabs/common/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useProfileManager.test.ts | 6 | 32 | プロファイル管理ロジック |
src/components/tabs/common/hooks/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useMatchTableData.test.ts | 5 | 11 | 試合テーブルデータ取得 |
src/components/tabs/db-viewer/components/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
MatchDetailView.test.tsx | 1 | 25 | 試合詳細ビュー |
src/components/tabs/db-viewer/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useMatchDetail.test.ts | 1 | 5 | 試合詳細データ取得 |
useMatchListState.test.ts | 1 | 10 | 試合一覧状態管理 |
src/components/tabs/log-analysis/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useLogAnalysisState.test.ts | 1 | 7 | ログ解析状態管理 |
useProfileSelection.test.ts | 1 | 5 | プロファイル選択 |
useRealtimeDeckTracker.test.ts | 1 | 9 | リアルタイムデッキトラッカー |
useRealtimeWatcherControls.test.ts | 1 | 24 | リアルタイム監視制御 |
useStaticAnalysis.test.ts | 1 | 8 | 静的解析 |
useStatisticsComputation.test.ts | 1 | 4 | 統計計算 |
src/components/tabs/player-dashboard/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useCharacterMatchupChartData.test.ts | 13 | 23 | キャラ対戦チャートデータ |
useCharacterMatchups.test.ts | 8 | 7 | キャラ対戦統計 |
useCharacterStats.test.ts | 6 | 8 | キャラ統計 |
useCharacterStatsChartData.test.ts | 5 | 6 | キャラ統計チャートデータ |
useCharacterWinRateChartData.test.ts | 14 | 29 | キャラ勝率チャートデータ |
useMatchesData.test.ts | 7 | 9 | 試合データ取得 |
useOpponentDetails.test.ts | 8 | 16 | 対戦相手詳細 |
useOpponentsAvailableChartData.test.ts | 6 | 6 | 対戦相手所持キャラデータ |
useOpponentStats.test.ts | 7 | 13 | 対戦相手統計 |
usePerformanceMetrics.test.ts | 8 | 11 | パフォーマンス指標 |
usePlayerDashboardState.test.ts | 1 | 5 | ダッシュボード状態管理 |
useSeasonAnalytics.test.ts | 3 | 28 | シーズン分析 |
src/components/tabs/realtime-analysis/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useBrowserAutomation.test.ts | 1 | 10 | ブラウザ自動化 |
src/components/tabs/settings/components/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
ThemeSelector.test.tsx | 1 | 3 | テーマ選択 |
src/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useElectronEvent.test.ts | 2 | 9 | Electronイベントハンドリング |
useLocalStorageState.test.ts | 1 | 8 | localStorage状態管理 |
useLogWatcher.test.ts | 8 | 41 | ログ監視フック |
useLogWatcherSettings.test.ts | 1 | 3 | ログ監視設定 |
useMatchConverter.test.ts | 1 | 6 | 試合データ変換 |
src/screens/bp-opponent/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
BPOpponentContainer.test.tsx | 1 | 9 | BP対戦相手コンテナ |
BPOpponentView.test.tsx | 1 | 14 | BP対戦相手ビュー |
src/screens/bp-opponent/hooks/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useBPOpponentData.test.ts | 1 | 7 | BP対戦相手データ |
useBPOpponentStats.test.ts | 1 | 13 | BP対戦相手統計 |
useUserSettings.test.ts | 2 | 14 | ユーザー設定 |
src/store/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
useOverlayStore.test.ts | 14 | 43 | オーバーレイストア (最大規模) |
src/store/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
index.test.ts | 8 | 18 | ストア基本テスト |
useOverlayStore-sync.spec.ts | 1 | 1 | ストア同期テスト |
src/store/sync/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
compositeAdapter.test.ts | 6 | 9 | 複合アダプター |
src/store/sync/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
broadcastAdapter.spec.ts | 1 | 2 | BroadcastChannel同期 |
electronAdapter.spec.ts | 1 | 2 | Electron IPC同期 |
localStorageAdapter.spec.ts | 1 | 2 | localStorage同期 |
wsAdapter.spec.ts | 1 | 2 | WebSocket同期 |
src/utils/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
Logger.test.ts | 3 | 11 | ロガーユーティリティ |
configSync.test.ts | 7 | 30 | 設定同期 |
formatters.test.ts | 4 | 17 | フォーマッター |
src/utils/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
obsUtils.spec.ts | 4 | 7 | OBS関連ユーティリティ |
src/utils/electronAPI/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
config.test.ts | 4 | 9 | 設定API |
database.test.ts | 6 | 16 | データベースAPI |
events.test.ts | 2 | 3 | イベントAPI |
fileSystem.test.ts | 3 | 9 | ファイルシステムAPI |
import.test.ts | 3 | 6 | インポートAPI |
system.test.ts | 4 | 9 | システムAPI |
userSettings.test.ts | 2 | 4 | ユーザー設定API |
window.test.ts | 6 | 16 | ウィンドウAPI |
src/utils/logAnalyzer/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
CharacterService.test.ts | 6 | 18 | キャラクターサービス |
LogIntegration.test.ts | 1 | 3 | ログ統合テスト |
LogParser.selfcontained.test.ts | 9 | 22 | ログパーサー (自己完結型) |
LogParser.test.ts | 5 | 11 | ログパーサー基本 |
LogParserCore.test.ts | 1 | 1 | ログパーサーコア基本 |
StatisticsCalculator.test.ts | 3 | 8 | 統計計算 |
src/utils/logAnalyzer/core/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
LogParserCore.test.ts | 17 | 66 | ログパーサーコア詳細 (最大規模) |
StreamLogParserV2.regression.test.ts | 1 | 1 | ストリームパーサー回帰テスト |
StreamLogParserV2.test.ts | 8 | 21 | ストリームパーサー基本 |
src/utils/logAnalyzer/core/__tests__/
| ファイル | describe | test/it | 内容 |
|---|---|---|---|
StreamLogParserV2.availableChars.test.ts | 0 | 8 | 所持キャラ枠追跡 |
テスト規模トップ5
| ファイル | test/it数 | カテゴリ |
|---|---|---|
src/utils/logAnalyzer/core/LogParserCore.test.ts | 66 | ログ解析コア |
src/store/useOverlayStore.test.ts | 43 | 状態管理 |
src/hooks/__tests__/useLogWatcher.test.ts | 41 | ログ監視 |
src/utils/configSync.test.ts | 30 | 設定同期 |
src/components/tabs/player-dashboard/hooks/__tests__/useCharacterWinRateChartData.test.ts | 29 | プレイヤーダッシュボード |
テストカテゴリ別集計
| カテゴリ | ファイル数 | test/it数 | 対象モジュール |
|---|---|---|---|
| ログ解析 | 10 | 168 | src/utils/logAnalyzer/ |
| プレイヤーダッシュボード | 12 | 161 | src/components/tabs/player-dashboard/ |
| Electronバックエンド | 14 | 73 | electron/ |
| 状態管理・同期 | 8 | 77 | src/store/ |
| 共通フック | 5 | 67 | src/hooks/ |
| BP対戦相手 | 5 | 43 | src/screens/bp-opponent/ |
| 共通コンポーネント | 6 | 69 | src/components/tabs/common/ |
| DBビューアー | 3 | 40 | src/components/tabs/db-viewer/ |
| ログ解析タブ | 6 | 57 | src/components/tabs/log-analysis/ |
| Electron APIラッパー | 8 | 72 | src/utils/electronAPI/ |
| ユーティリティ | 4 | 65 | src/utils/ (logAnalyzer以外) |
| その他 | 4 | 34 | 共通UI, ブラウザ自動化, リアルタイム分析, 設定 |