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.

Fastcheck: Property based testing for JavaScript and TypeScript

61 pointsby alokraiover 4 years ago

6 comments

acjohnson55over 4 years ago
I got into property-based testing when doing a lot of Scala, and I'm a big fan. Beyond trivial tests, it begins to require a whole different bag of techniques to write good tests. But I think it's worth the investment. The key benefit, IMO, is that it helps remove "happy path bias", in which I, as the author, have a hard time getting out of my assumptions about inputs.
auscompgeekover 4 years ago
For those looking for property based testing for Python: <a href="https:&#x2F;&#x2F;hypothesis.works" rel="nofollow">https:&#x2F;&#x2F;hypothesis.works</a>
glenjaminover 4 years ago
The clojure&#x2F;clojurescript tooling for QuickCheck is quite powerful - as it has a wide range of generators which are able to generate smarter &#x2F; more specific data than simply matching on types.<p>And since clojurescript can be compiled and exported to JavaScript, this makes it available to JavaScript projects. A few years ago I packaged this up as <a href="https:&#x2F;&#x2F;github.com&#x2F;glenjamin&#x2F;checkers" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;glenjamin&#x2F;checkers</a>. I expect there are newer versions of the underlying library available now, but as I haven&#x27;t been working in this ecosystem for a while, I haven&#x27;t kept the package up to date.
richyliuover 4 years ago
This seems similar in concept to Haskell’s QuickCheck[1]. Both generate tests based on an invariant&#x2F;“property” of the output and can narrow down to the simplest failing test case.<p>[1]: <a href="https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;QuickCheck" rel="nofollow">https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;QuickCheck</a>
评论 #26151035 未加载
pseudorambleover 4 years ago
Looks pretty nice. I only have a little exposure to jsverify. How does fastcheck compare to that? On the surface it looks a bit more modern using TS, but that doesn’t tell one much.
评论 #26197490 未加载
评论 #26151461 未加载
techtangents2over 4 years ago
I&#x27;ve been using fast-check for about a year now. It&#x27;s really good.