Newshot

Show HN:在本地生成 Angular TestBed 测试规格与 Storybook 故事,无需 LLM

Translation(model translation, not the source's own text)

文章标题:Show HN: 本地生成 Angular TestBed 规格与 Storybook 故事,无需 LLM

正文:

本地生成 Angular 规格与故事。

ngTestFoundry 是一款 VS Code 扩展,可根据组件源码,确定性地生成 Angular TestBed 规格与 CSF3 Storybook 故事的初稿。

ngTestFoundry 在 VS Code 中生成 Angular TestBed 规格
ngTestFoundry 在 VS Code 中生成 Angular TestBed 规格

为无聊的初稿而生。

目标不是魔法。目标是提供一个有用、可重复的起点,让开发者能像对待普通代码一样审阅和调整。

TestBed 规格

生成 .spec.ts 脚手架,包含组件导入、浅层 providers、必需 inputs 和基础创建断言。

Storybook 故事

生成 CSF3 .stories.ts 文件,根据组件 inputs 和 outputs 推断 args。

现代 Angular

最适合使用 input()、model()、output()、inject()、@Input() 和 @Output() 的独立组件。

单个组件免费。工作流规模化用 Pro。

免费

在当前活跃的 Angular 组件上使用核心生成器。

  • 从当前活跃组件生成一个规格。
  • 从当前活跃组件生成一个故事。
  • 仅本地静态分析。

Pro

在更大的工作区和团队风格中使用 ngTestFoundry。

  • 跨工作区批量生成规格。
  • 跨工作区批量生成故事。
  • 使用自定义 Eta 模板覆盖输出。

诚实的限制。

ngTestFoundry 更倾向于显式 TODO,而非静默猜测。目前它最擅长处理 Angular 17.3+ 独立组件。


        当前限制:
- 非独立 NgModule 图解析已列入计划。
- 依赖 mock 为浅层。
- Vitest 输出已列入计划。
      

在一个真实组件上试试。

最有用的反馈是生成的 TestBed 形态能否在真实的 Angular 工作区中正常工作。

先看生成的形态。

安装之前,你可以查看生成的 TestBed 规格和 Storybook 故事的真实示例,包括 ngTestFoundry 在静态分析不应猜测时留下的 TODO。

发布说明

简要说明 ngTestFoundry 为何存在、目前支持什么、生成什么,以及哪些反馈最有帮助。

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗