(aws-cdk): use either vitest or Node.js Test Runner for testing instead of jest

未关闭
#936 7 条评论 10 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
领域
cli, testing-qa

调研方向

定位由 cdk init app 生成的 TypeScript 应用模板,先检查其生成的 package.json 和测试设置。在 Vitest 和 Node.js Test Runner 之间做出选择,然后验证生成的项目不再需要 Jest、ts-jest 或 @types/jest,并且其单元测试能够成功运行。

由索引模型根据 Issue 内容生成。

描述

aws-cdk feature-request p2
Describe the feature

I followed Tutorial: Create your first AWS CDK app and ran the following command

$ hello-cdk> cdk --version
2.1031.2 (build 779352d)

$ hello-cdk> cdk init app --language typescript
...

It uses jest by default which requires additional dependency ts-jest for setup, as well as explicit installation of @types/jest

$ grep jest package.json 
    "test": "jest",
    "@types/jest": "^29.5.14",
    "jest": "^29.7.0",
    "ts-jest": "^29.2.5",
Use Case

Over the years, the vitest seems to be becoming popular test framework.

There are several comparisons online, and npm trends shows vitest growing faster than jest.

If cdk init project uses vitest, the CDK customers will benefit from improved performance. Vitest has first-class support for TypeScript, so the types and additional dependencies are not required to be installed.

Even better, the CDK project can just use Node.js test runner instead. It should have enough features which CDK customers might need for their test setup.

Proposed Solution

Use vitest or Node.js Test Runner instead of jest for unit testing.

Other Information
npm trends jest vs vitest Image
Acknowledgements
  • I may be able to implement this feature request
  • This feature might incur a breaking change
CDK version used

2.1031.2

Environment details (OS name and version, etc.)

All

主要语言
TypeScript
星标
110
派生
138
平均合并
1 天 9 小时
30 天内合并 PR
55

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/aws-cdk-cli 的其他 Issue

查看 aws/aws-cdk-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。