Skip to content

fix: Jest の新しいカバレッジ閾値エラー文言にテストを追従 - #915

Closed
keito4 wants to merge 2 commits into
mainfrom
fix/914-jest-threshold-message
Closed

fix: Jest の新しいカバレッジ閾値エラー文言にテストを追従#915
keito4 wants to merge 2 commits into
mainfrom
fix/914-jest-threshold-message

Conversation

@keito4

@keito4 keito4 commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Why

test/jest-config.test.js の coverage threshold テストが Jest の旧エラー文言 does not meet "global" threshold を期待しており、現行 Jest の出力形式(Jest: "global" coverage threshold for statements (70%) not met: 0%)と不一致でテストスイートが失敗していた。

What

  • アサーションを実際の出力形式にマッチする正規表現 /"global" coverage threshold for \w+ \(\d+%\) not met/ に変更
  • あわせて、pre-commit の format ゲートを塞いでいた .claude/hooks/README.mdAGENTS.md の prettier フォーマット崩れを別コミットで修正

How

Jest を実際に閾値未達条件で実行して出力形式を確認し、文言の骨格(kind と % は可変)に対して正規表現でマッチさせる方式にした。

Risk

テストのアサーション変更のみで実装コードへの影響なし。Jest が再度文言を変えた場合はこのテストが検知する。

Closes #914

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Reformatted markdown tables in internal guides for clearer layout and consistent column alignment.
    • Updated the displayed structure of pattern and quality-gate reference tables without changing the listed items.
  • Tests

    • Adjusted a test expectation to better match Jest’s coverage-threshold error output.

keito4 and others added 2 commits July 3, 2026 14:18
Jest がカバレッジ閾値未達を 'coverage threshold for <kind> (<n>%) not met'
形式で出力するようになり、旧文言 'does not meet "global" threshold' を
期待するアサーションが失敗していた。実際の出力形式にマッチする正規表現に変更。

Closes #914

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
.claude/hooks/README.md と AGENTS.md が prettier --check に失敗し
pre-commit ゲートを塞いでいたため整形。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 0s —— View job


I'll analyze this and get back to you.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR reformats Markdown tables in .claude/hooks/README.md and AGENTS.md (no content changes), and updates a Jest test assertion in test/jest-config.test.js to use a regex matching the current coverage-threshold failure message format.

Changes

Documentation formatting and test assertion fix

Layer / File(s) Summary
Markdown table reformatting
.claude/hooks/README.md, AGENTS.md
Re-aligned header and separator rows of the secret-detection patterns table and the Quality Gates table; content unchanged.
Jest coverage threshold assertion fix
test/jest-config.test.js
Updated the coverage-threshold failure assertion to a regex matching Jest's "global coverage threshold ... not met" message.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • keito4/config#156: Both PRs modify the AGENTS.md "Quality Gates" table formatting.
  • keito4/config#192: Both PRs update test/jest-config.test.js coverage-threshold assertions related to Jest coverage thresholds.
  • keito4/config#609: Both PRs modify the "Quality Gates" table content/formatting in AGENTS.md.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The markdown formatting changes in .claude/hooks/README.md and AGENTS.md are unrelated to #914 and exceed the linked issue scope. Move the formatting-only changes into a separate PR or link them to an issue that explicitly requires the pre-commit fixes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: updating the Jest coverage-threshold test to the new error wording.
Description check ✅ Passed The description covers why, what, how, and risk, and links the issue, though it does not match the template headings exactly.
Linked Issues check ✅ Passed The Jest assertion now matches the requested coverage-threshold regex, satisfying the direct issue #914.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/914-jest-threshold-message

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

test/jest-config.test.js

Oops! Something went wrong! :(

ESLint: 10.6.0

ReferenceError: describe is not defined
at Object. (/test/eslint-config.test.js:35:1)
at Module._compile (node:internal/modules/cjs/loader:1830:14)
at Object..js (node:internal/modules/cjs/loader:1961:10)
at Module.load (node:internal/modules/cjs/loader:1553:32)
at Module._load (node:internal/modules/cjs/loader:1355:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:326:3)
at ModuleWrap. (node:internal/modules/esm/translators:231:7)
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async node:internal/modules/esm/loader:639:26


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/hooks/README.md:
- Around line 163-176: The markdown table in the hooks README has a malformed
separator row with extra pipe-delimited cells, which breaks the intended
two-column layout. Update the table formatting so the separator row under the
header matches only the two columns used by the pattern/label rows, and verify
the entries in the surrounding table remain aligned and render correctly in
Markdown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74b9dc89-8199-4895-9af5-9e7a86098692

📥 Commits

Reviewing files that changed from the base of the PR and between 4b486f1 and 143666a.

📒 Files selected for processing (3)
  • .claude/hooks/README.md
  • AGENTS.md
  • test/jest-config.test.js

Comment thread .claude/hooks/README.md
Comment on lines +163 to +176
| パターン | ラベル |
| ---------------------------------------- | ---------------------------- | ------------------- | --- | ---- | ----------- | ---------------- |
| `(AKIA | ASIA)[0-9A-Z]{16}` | AWS アクセスキー ID |
| `aws_secret_access_key=...` | AWS シークレットアクセスキー |
| `ghp_...` / `gho_...` / `github_pat_...` | GitHub トークン(3種) |
| `sk-ant-...` | Anthropic API キー |
| `sk-proj-...` / `sk-...` | OpenAI キー |
| `xox[baprs]-...` | Slack トークン |
| `[sr]k\_(live | test)\_...` | Stripe キー |
| `lin_api_...` | Linear API キー |
| `AIza...` | Google API キー |
| `glpat-...` | GitLab PAT |
| `(AKIA | ASIA)[0-9A-Z]{16}` | AWS アクセスキー ID |
| `aws_secret_access_key=...` | AWS シークレットアクセスキー |
| `ghp_...` / `gho_...` / `github_pat_...` | GitHub トークン(3種) |
| `sk-ant-...` | Anthropic API キー |
| `sk-proj-...` / `sk-...` | OpenAI キー |
| `xox[baprs]-...` | Slack トークン |
| `[sr]k\_(live | test)\_...` | Stripe キー |
| `lin_api_...` | Linear API キー |
| `AIza...` | Google API キー |
| `glpat-...` | GitLab PAT |
| `dp.(pt | st | sa | ct | scim | audit)....` | Doppler トークン |
| `-----BEGIN ... PRIVATE KEY-----` | 秘密鍵 |
| `-----BEGIN ... PRIVATE KEY-----` | 秘密鍵 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Keep the separator row to two columns.

The new separator line declares extra pipe-delimited cells, so this no longer matches the two-column header and may render incorrectly in Markdown.

Suggested fix
-| ---------------------------------------- | ---------------------------- | ------------------- | --- | ---- | ----------- | ---------------- |
+| ---------------------------------------- | ---------------------------- |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| パターン | ラベル |
| ---------------------------------------- | ---------------------------- | ------------------- | --- | ---- | ----------- | ---------------- |
| `(AKIA | ASIA)[0-9A-Z]{16}` | AWS アクセスキー ID |
| `aws_secret_access_key=...` | AWS シークレットアクセスキー |
| `ghp_...` / `gho_...` / `github_pat_...` | GitHub トークン(3種) |
| `sk-ant-...` | Anthropic API キー |
| `sk-proj-...` / `sk-...` | OpenAI キー |
| `xox[baprs]-...` | Slack トークン |
| `[sr]k\_(live | test)\_...` | Stripe キー |
| `lin_api_...` | Linear API キー |
| `AIza...` | Google API キー |
| `glpat-...` | GitLab PAT |
| `(AKIA | ASIA)[0-9A-Z]{16}` | AWS アクセスキー ID |
| `aws_secret_access_key=...` | AWS シークレットアクセスキー |
| `ghp_...` / `gho_...` / `github_pat_...` | GitHub トークン(3種) |
| `sk-ant-...` | Anthropic API キー |
| `sk-proj-...` / `sk-...` | OpenAI キー |
| `xox[baprs]-...` | Slack トークン |
| `[sr]k\_(live | test)\_...` | Stripe キー |
| `lin_api_...` | Linear API キー |
| `AIza...` | Google API キー |
| `glpat-...` | GitLab PAT |
| `dp.(pt | st | sa | ct | scim | audit)....` | Doppler トークン |
| `-----BEGIN ... PRIVATE KEY-----` | 秘密鍵 |
| `-----BEGIN ... PRIVATE KEY-----` | 秘密鍵 |
| パターン | ラベル |
| ---------------------------------------- | ---------------------------- |
| `(AKIA | ASIA)[0-9A-Z]{16}` | AWS アクセスキー ID |
| `aws_secret_access_key=...` | AWS シークレットアクセスキー |
| `ghp_...` / `gho_...` / `github_pat_...` | GitHub トークン(3種) |
| `sk-ant-...` | Anthropic API キー |
| `sk-proj-...` / `sk-...` | OpenAI キー |
| `xox[baprs]-...` | Slack トークン |
| `[sr]k\_(live | test)\_...` | Stripe キー |
| `lin_api_...` | Linear API キー |
| `AIza...` | Google API キー |
| `glpat-...` | GitLab PAT |
| `dp.(pt | st | sa | ct | scim | audit)....` | Doppler トークン |
| `-----BEGIN ... PRIVATE KEY-----` | 秘密鍵 |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/hooks/README.md around lines 163 - 176, The markdown table in the
hooks README has a malformed separator row with extra pipe-delimited cells,
which breaks the intended two-column layout. Update the table formatting so the
separator row under the header matches only the two columns used by the
pattern/label rows, and verify the entries in the surrounding table remain
aligned and render correctly in Markdown.

@keito4

keito4 commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

撤回します。この失敗はリポジトリのバグではなく、ローカルの node_modules が lockfile と乖離していた(古い Jest がテスト時に旧文言を出力していた)ことが原因でした。npm ci で同期後、main の元のアサーションは Jest 30.4.1 で正常にパスすることを確認済みです。

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: jest-config.test.js が Jest の新しいカバレッジ閾値エラー文言に追従していない

1 participant