Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
6938703
test: ミューテーションテスト導入と全体スコア改善
windschord Mar 17, 2026
2c96e2f
fix: テストファイルのlintエラーを修正
windschord Mar 17, 2026
b53358a
fix: CI失敗テストの修正 - API routeテストをmainに戻す
windschord Mar 17, 2026
9842f23
fix: PRレビュー指摘の修正
windschord Mar 17, 2026
0ea6e9e
fix: CodeRabbitレビュー指摘の修正(2回目)
windschord Mar 17, 2026
eaa6865
fix: Copilotレビュー指摘の修正(pullTimeout初期化、リスナーリーク防止)
windschord Mar 17, 2026
a806cf8
fix: 全レビュー指摘の最終修正
windschord Mar 17, 2026
f369f28
fix: @types/tar-fs依存パッケージを復元
windschord Mar 17, 2026
b2479be
fix: docker image-buildテストのエラーメッセージをmainに合わせる
windschord Mar 17, 2026
8cfcdb4
fix: mutation-testジョブのdiff取得をSHA方式に変更
windschord Mar 17, 2026
ca300a6
fix: git diff失敗時にmutation-testジョブを明示的に失敗させる
windschord Mar 17, 2026
1878f17
fix: terminal-wsテストのresizeフォールバックパターンを修正
windschord Mar 17, 2026
ad1fb01
fix: レビュー指摘修正(JSDoc整合性、IPv6テスト、it.skip解除)
windschord Mar 17, 2026
ed9d9ef
fix: レビュー指摘修正(テストパターン統一、try/catch→rejects、waitForListener統一)
windschord Mar 17, 2026
9de3b38
fix: proxy-client テストの .catch((e) => e) を rejects パターンに変更し、deleteRule…
windschord Mar 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,73 @@ jobs:
include-hidden-files: true
retention-days: 1

# Mutation testing - runs only on PRs for changed files
mutation-test:
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event_name == 'pull_request'

env:
DATABASE_URL: file:./data/test.db

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # diff計算のため

- name: Setup project
uses: ./.github/actions/setup

- name: Get changed files for mutation testing
id: changed-files
run: |
# PRのベースコミットとの差分から対象ファイルを取得(SHA指定で確実に動作)
RAW_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }}...${{ github.sha }} -- \
'src/services/**/*.ts' 'src/lib/**/*.ts') || {
echo "::error::git diff failed while collecting mutation targets"
exit 1
}
CHANGED_FILES=$(printf '%s\n' "$RAW_CHANGED_FILES" | \
grep -Ev '(__tests__|\.test\.ts$|\.spec\.ts$)' || true)

if [ -z "$CHANGED_FILES" ]; then
echo "No mutation test target files changed"
echo "has_targets=false" >> $GITHUB_OUTPUT
else
echo "Changed files for mutation testing:"
echo "$CHANGED_FILES"
# Stryker --mutate形式に変換 (カンマ区切り)
MUTATE_TARGETS=$(echo "$CHANGED_FILES" | tr '\n' ',' | sed 's/,$//')
echo "mutate_targets=$MUTATE_TARGETS" >> $GITHUB_OUTPUT
echo "has_targets=true" >> $GITHUB_OUTPUT
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Run mutation testing
if: steps.changed-files.outputs.has_targets == 'true'
run: |
# 動的にmutate対象を指定してStrykerを実行
# break: 85でスコア85%未満なら失敗
# mutate_targetsはカンマ区切り文字列なので、そのまま--mutateに渡す
pnpm exec stryker run \
--mutate "${{ steps.changed-files.outputs.mutate_targets }}" \
--reporters clear-text,progress \
--thresholds.break 85
Comment on lines +252 to +267
timeout-minutes: 25

- name: Report mutation score to summary
if: always() && steps.changed-files.outputs.has_targets == 'true'
run: |
echo "## Mutation Testing Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Target files:** ${{ steps.changed-files.outputs.mutate_targets }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Threshold:** 85%" >> $GITHUB_STEP_SUMMARY

# Final check - ensures all jobs passed
ci-check:
runs-on: ubuntu-latest
timeout-minutes: 1
needs: [lint, test-backend, test-frontend, test-e2e, build]
needs: [lint, test-backend, test-frontend, test-e2e, build, mutation-test]
if: always()

steps:
Expand All @@ -232,4 +294,10 @@ jobs:
echo "One or more jobs failed"
exit 1
fi
# mutation-test is only run on PRs, so skipped is acceptable
if [ "${{ needs.mutation-test.result }}" != "success" ] && \
[ "${{ needs.mutation-test.result }}" != "skipped" ]; then
echo "Mutation test job failed"
exit 1
fi
echo "All jobs passed successfully"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,7 @@ data/repos/

# Encryption key (auto-generated, must not be committed)
data/encryption.key

# Stryker mutation testing
reports/mutation/
.stryker-tmp/
Binary file modified data/test.db-shm
Binary file not shown.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"test": "vitest run",
"test:pm2": "pm2 start ecosystem.config.js --only claude-work-test",
"test:watch": "vitest",
"test:mutation": "stryker run",
"test:watch:pm2": "pm2 start ecosystem.config.js --only claude-work-test-watch",
"e2e": "playwright test",
"e2e:ui": "playwright test --ui",
Expand Down Expand Up @@ -72,15 +73,17 @@
"@eslint/eslintrc": "^3.3.3",
"@next/eslint-plugin-next": "^16.1.6",
"@playwright/test": "^1.57.0",
"@stryker-mutator/core": "^9.6.0",
"@stryker-mutator/vitest-runner": "^9.6.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@types/better-sqlite3": "^7.6.13",
"@types/dockerode": "^4.0.1",
"@types/tar-fs": "^2.0.4",
"@types/node": "^20",
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"@types/tar-fs": "^2.0.4",
"@types/ws": "^8.18.1",
"@vitejs/plugin-react": "^5.1.2",
"@vitest/coverage-v8": "^4.0.18",
Expand Down
Loading
Loading