Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Test: use vitest instead of jest #75

Merged
merged 12 commits into from
Apr 7, 2022
Merged

Test: use vitest instead of jest #75

merged 12 commits into from
Apr 7, 2022

Conversation

luhc228
Copy link
Member

@luhc228 luhc228 commented Apr 7, 2022

Why

  1. 更快的单测速度。相同的单测,Jest 需要约40s,Vitest 仅需要约 10s
  2. 对含有 dynamic imports 的单测支持更好。使用 Jest 进行单测时,会出现问题,修复的成本较高 runInBand + dynamic imports break in Jest 27.0.0-next.11 jestjs/jest#11438
  3. 由于 vitest 默认对 ts 支持,少了很多配置项

@luhc228 luhc228 self-assigned this Apr 7, 2022
@vercel
Copy link

vercel bot commented Apr 7, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/imsobear/ice-next/9LMp7WpcbudJzoJ3AZwgsQ4W9WjM
✅ Preview: https://ice-next-git-test-use-vitest-imsobear.vercel.app

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@ClarkXia
Copy link
Collaborator

ClarkXia commented Apr 7, 2022

没看到多个集成测试用例,需要覆盖下这个场景

@luhc228
Copy link
Member Author

luhc228 commented Apr 7, 2022

没看到多个集成测试用例,需要覆盖下这个场景

先合了这个PR,新的 集成测试用例在这个 PR 里 #69

@SoloJiang
Copy link

jest 的 transformer 换成 @swc/jest 是不是问题就都解掉了?

@ClarkXia
Copy link
Collaborator

ClarkXia commented Apr 7, 2022

jest 的 transformer 换成 @swc/jest 是不是问题就都解掉了?

可能跟 transformer 关系不大,核心是执行 esm 模块的时候有问题,特别是串行执行的时候,详见 jestjs/jest#11438

@ClarkXia ClarkXia merged commit 852fe1e into release-next Apr 7, 2022
@ClarkXia ClarkXia deleted the test/use-vitest branch April 7, 2022 08:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants