Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Vitest #70

Merged
merged 5 commits into from
Feb 24, 2024
Merged

Migrate to Vitest #70

merged 5 commits into from
Feb 24, 2024

Conversation

trpfrog
Copy link
Owner

@trpfrog trpfrog commented Feb 24, 2024

resolves #67

Vitest に移行した。

Why Vitest?

  • Jest, ESM に対応しておらず CommonJS を経由する必要がありつらい
  • Jest より速い

作業手順

  • まず Next.js Docs 通りに導入
  • bun rm jest ts-jest @types/jest jest-environment-jsdom
  • rm jest.config.js
  • mv jest.setup.js vitest.setup.js して config に setupFiles: './vitest.setup.ts' を追加
  • jsdom => happy-dom
    • jsdom より速いらしい
    • bun rm jsdom && bun add -D happy-dom
    • Config の environmenthappy-dom に変更
  • Config に path alias を追加
  • CSS Modules の設定を config に追加 (classNameStrategy: 'non-scoped')
  • テストコード中の jest.*vi.* に置換
  • global で expect などを使えるように globals: true を config に追加

Copy link

vercel bot commented Feb 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
trpfrog-net ✅ Ready (Inspect) Visit Preview Feb 24, 2024 10:33am

@trpfrog trpfrog merged commit 811260a into main Feb 24, 2024
3 checks passed
@trpfrog trpfrog deleted the migrate-to-vitest branch February 24, 2024 10:37
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.

Jest → Vitest か bun:test
1 participant