TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Are Tests Necessary in TypeScript?

17 点作者 mrbbk大约 5 年前

6 条评论

geoelectric大约 5 年前
The article title is going to get people to summary judge without reading.<p>The actual article is a nice exploration of prioritizing unit tests based on context-driven testing principles: the decision-making around how to concentrate tests on your codebase in areas that need it, while not getting hung up on dogmatically creating them for areas that are already stable enough.
评论 #22860861 未加载
beder大约 5 年前
I was on board for points 1 and 2, but completely disagree with 3:<p>&gt; The components might look wrong when rendered. Tests are very bad at this. We don&#x27;t want to go down the esoteric and labor-intensive path of automated image capture and image diffing.<p>This is <i>the</i> main reason we have tests for our (Angular) typescript all; all the tests roughly look like:<p>1. set up component with fake data<p>2. take screenshot and compare with golden<p>3. (maybe) interact with component and verify change<p>These are super easy to write, and also easy to review: most review comments are on the screenshots anyways. And since the goldens are checked in, it’s easy to see what different parts of the app look like without starting it up.
评论 #22869737 未加载
brutal_chaos_大约 5 年前
Does TypeScript test your logic for you? &#x2F;snarky_response
ng12大约 5 年前
I agree with this sentiment; I try to not test anything that renders. I don&#x27;t want to test React&#x27;s correct handling of the DOM and I don&#x27;t want tests that fail if someone changes a div to a span. The stuff I&#x27;m looking to test tends to be the code that naturally feels like it belongs in a helper function.
celim307大约 5 年前
Anyone have experience with <a href="https:&#x2F;&#x2F;www.chromaticqa.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.chromaticqa.com&#x2F;</a><p>Seems like a great solution
daotoad大约 5 年前
Yes.<p>Now you don&#x27;t have to RTFA.