TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Are Tests Necessary in TypeScript?

17 pointsby mrbbkabout 5 years ago

6 comments

geoelectricabout 5 years ago
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 未加载
bederabout 5 years ago
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_about 5 years ago
Does TypeScript test your logic for you? &#x2F;snarky_response
ng12about 5 years ago
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.
celim307about 5 years ago
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
daotoadabout 5 years ago
Yes.<p>Now you don&#x27;t have to RTFA.