Skip to content

jest -> vitest#106

Closed
nemuvski wants to merge 3 commits into
mainfrom
update-dev-deps
Closed

jest -> vitest#106
nemuvski wants to merge 3 commits into
mainfrom
update-dev-deps

Conversation

@nemuvski

@nemuvski nemuvski commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • テストランナーをVitestに切り替え、実行・ウォッチ・カバレッジ用のスクリプトを更新しました。
    • テスト用のグローバルAPIを有効化し、実行環境設定を整備しました。
  • Tests
    • モック作成・リセット処理をVitest(vi.fnvi.resetAllMocks)に統一しました。
  • Chores
    • Jest関連設定を整理し、Vitest側の設定・ESLint/TypeScriptのテスト向け調整を行いました。
  • CI
    • テスト実行用のNode.jsバージョン対象を更新しました。

@nemuvski nemuvski self-assigned this Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

テスト基盤をJestからVitestへ移行し、関連する設定、依存関係、型定義、テスト内モック呼び出し、CIのNode.js行列を更新した。

Changes

Jest から Vitest への移行

Layer / File(s) Summary
Vitest設定と実行基盤
vitest.config.ts, vitest.setup.ts, jest.config.js, package.json, .github/workflows/ci.yml
Vitest設定を追加し、Jest設定を削除。package.jsonのテストスクリプトと依存関係をVitest向けに更新し、CIのNode.js行列を変更。
LintとTypeScriptのVitest対応
.eslintrc.js, tsconfig.json
ESLintのテストグローバル定義をVitest向けに更新し、TypeScriptの型定義とtestsディレクトリのincludeを変更。
テスト内モックのVitest置換
tests/getAllContentIds.test.ts, tests/getAllContents.test.ts, tests/lib/fetch.test.ts, tests/requestInit.test.ts, tests/uploadMedia.test.ts, tests/write.test.ts
各テストでjest系モックAPIをVitestのvi/Mockに置き換え。

Estimated code review effort: 2 (Simple) | ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 主要な変更点であるテスト基盤の Jest から Vitest への移行を簡潔に表しており、内容と一致しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-dev-deps

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

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

37-37: 🩺 Stability & Availability | 🔵 Trivial

Node.js 26.xはまだLTSではない点に留意

Node.js 26は2026年5月にリリースされたばかりの「Current」ラインであり、LTS移行は2026年10月予定です。CIマトリクスに含めること自体は将来互換性の早期検証として有用ですが、Currentリリースはリリース頻度が高くAPI変更の影響を受けやすいため、CI失敗が本体コードの問題ではなくNode側の変更に起因する可能性がある点に留意してください。

🤖 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 @.github/workflows/ci.yml at line 37, The CI matrix currently includes
Node.js 26.x, which is a Current release rather than LTS, so treat it as an
optional forward-compatibility job in the workflow. Update the matrix in the CI
workflow to either remove 26.x if only LTS support is intended, or explicitly
allow it to fail / label it as non-blocking so failures there don’t mask issues
in the main supported versions. Refer to the node-version matrix entry in the CI
workflow.
🤖 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 @.github/workflows/ci.yml:
- Line 37: The CI matrix in build-and-test is out of sync with the stated
Node.js support: it starts at 20.x while package.json and the README files still
say v18+ is supported. Update the node-version matrix in ci.yml to include 18.x
if Node 18 remains supported, or otherwise align the support declaration by
updating the engines field in package.json and the Node version wording in
README.md and README_jp.md to match the actual CI support.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Line 37: The CI matrix currently includes Node.js 26.x, which is a Current
release rather than LTS, so treat it as an optional forward-compatibility job in
the workflow. Update the matrix in the CI workflow to either remove 26.x if only
LTS support is intended, or explicitly allow it to fail / label it as
non-blocking so failures there don’t mask issues in the main supported versions.
Refer to the node-version matrix entry in the CI workflow.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e25c714-8c08-4afb-9eec-ef35e1a89a0f

📥 Commits

Reviewing files that changed from the base of the PR and between 5267ac3 and 26af568.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
strategy:
matrix:
node-version: [18.x, 20.x, 22.x, 24.x]
node-version: [20.x, 22.x, 24.x, 26.x]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files .github/workflows/ci.yml package.json

echo
echo "== ci.yml around node-version =="
nl -ba .github/workflows/ci.yml | sed -n '1,120p'

echo
echo "== package.json engines =="
nl -ba package.json | sed -n '1,80p'

Repository: microcmsio/microcms-js-sdk

Length of output: 288


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== ci.yml around node-version =="
sed -n '1,120p' .github/workflows/ci.yml | cat -n

echo
echo "== package.json engines =="
sed -n '1,80p' package.json | cat -n

Repository: microcmsio/microcms-js-sdk

Length of output: 4191


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== .node-version =="
if [ -f .node-version ]; then
  cat -n .node-version
else
  echo "(missing)"
fi

echo
echo "== Node support mentions =="
rg -n --hidden --glob '!dist/**' --glob '!node_modules/**' \
  -e 'Node\.js|node version|engines|>=18|18\.x|20\.x|22\.x|24\.x|26\.x' \
  README* package.json .github/workflows ./

Repository: microcmsio/microcms-js-sdk

Length of output: 19113


Node 18 の検証をマトリクスに戻すか、サポート表記を揃えてください
package.jsonREADME.md / README_jp.md ではまだ Node.js v18+ をサポート対象としているのに、.github/workflows/ci.ymlbuild-and-test20.x からしか回っていません。18 を継続サポートするなら 18.x を追加し、切るなら engines と README もまとめて更新してください。

🤖 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 @.github/workflows/ci.yml at line 37, The CI matrix in build-and-test is out
of sync with the stated Node.js support: it starts at 20.x while package.json
and the README files still say v18+ is supported. Update the node-version matrix
in ci.yml to include 18.x if Node 18 remains supported, or otherwise align the
support declaration by updating the engines field in package.json and the Node
version wording in README.md and README_jp.md to match the actual CI support.

@nemuvski nemuvski closed this Jul 3, 2026
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.

1 participant