frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

The distinction between Testing Library and unit testing

https://www.echooff.dev/blog/why-testing-library-is-not-unit-testing
2•lo1tuma•1h ago

Comments

lo1tuma•59m ago
I agree with the author that precise terminology matters, calling something “unit testing” when it isn’t can definitely blur discussions.

That said, I think the underlying issue isn’t Testing Library itself, but the broader reality that testability in React is inherently limited by its design. As J. B. Rainsberger put it: "If it’s hard to test your code, it’s a sign of a design problem." In my experience, this is one of the most reliable heuristics for evaluating a framework or library.

When I look at a new technology, testability is the very first thing I evaluate, by far the most important property. I don’t care much about performance, bundle size, or reactivity models if the code is hard to test. If it is, I’ll reject it immediately. Hard-to-test systems tend to accumulate complexity quickly, and over time that translates directly into slower iteration, more regressions, and less confidence in changes.

For context, I’ve been working as a software engineer for 15+ years, mostly on medium to large frontend codebases, and using React since around 2014. A large portion of my day-to-day work is writing and maintaining unit tests. Many of the projects I’ve worked on have test suites in the five-figure range that run in under 10 seconds (using fairly simple tooling like Mocha). With that setup, we’ve been able to sustain very high deployment frequencies (10–100 deploys per day), even to the point of auto-merging dependency updates on weekends with automatic deployment, without introducing regressions over long periods of time.

That’s why I’m fairly skeptical when people claim unit testing is overkill or doesn’t add value. In well-designed systems, it’s the opposite: strong unit testability is what enables speed and safety at scale. Integration tests still have their place, but mostly to cover happy paths and verify wiring, not to compensate for missing unit-level confidence.

Coming back to React: compared to other modern frontend frameworks, it’s arguably still in the best position for unit testing, but that’s a very low bar. Vue and Svelte typically require compilation steps and framework-specific tooling, and others like Solid often rely on a real DOM as well. The deprecated react-test-renderer at least allowed some level of isolation, but its developer experience was poor enough that it never became a great solution.

What bothers me more is the official push toward testing in a real DOM environment. Many React components are not even meant to run in a browser DOM in production, think of server components, React Native, react-three-fiber, or Ink. If the framework’s value proposition is to abstract away the runtime environment, then requiring developers to reintroduce that environment in tests feels like a step backwards.

More broadly, this seems to reflect a shift in priorities. Modern frameworks often optimize for advanced capabilities, things like page transitions, complex rendering patterns, or aggressive performance techniques, that are interesting from a technical perspective but not necessarily required in the majority of real-world applications.

In many production systems I’ve worked on, UI behavior is surprisingly simple: mostly static layouts with some interaction and, at most, basic hover effects. Even things like CSS animations are rarely used in practice (I’m still waiting for a real opportunity to use them in a professional context), let alone more advanced concepts like page transitions. As developers, we tend to be excited about these capabilities (I definitely am) but they often don’t materially impact the actual product.

From that perspective, optimizing frameworks around these concerns while testability remains difficult feels like a questionable trade-off. In day-to-day work, the real challenge is maintaining correctness and evolvability over time, and testability is a key enabler for that. It should arguably be a primary design goal, not an afterthought.

This becomes even more important in the current context where AI-assisted development is becoming more common. AI tools are very good at producing code quickly, but they are also very good at introducing subtle regressions. In that environment, a strong automated test suite (ideally following the test pyramid) becomes essential. The goal is to reach a level of confidence where applying AI-generated changes does not introduce fear, because the tests provide fast and reliable feedback. That only works if tests are fast, isolated, and easy to write, which again brings us back to testability as a core design concern.

Ideally, I’d expect the framework to guarantee correct behavior at the environment boundary. From an application perspective, tests should focus on verifying behavior against the framework’s public API, not re-specifying the runtime details the framework is supposed to hide.

I don’t think Testing Library is the main problem here. It feels more like a symptom of a deeper issue: testing React components is hard because of how React is designed. Testing Library doesn’t really fix that, it just works around it by pushing tests toward a more integration-style approach. The real problem is testability itself. If React made it easier to write small, isolated tests, tools like Testing Library wouldn’t need to fill that gap. In that sense, the root cause isn’t the testing tools, but the framework, and that’s where improvements would have the biggest impact.

Mastermind – agentic SDLC workflow for VS Code

1•ArkadiuszSiAI•25s ago•0 comments

Andrej Karpathy: How I use LLMs [video]

https://www.youtube.com/watch?v=EWvNQjAaOHw
1•simonebrunozzi•1m ago•0 comments

Automated systematic literature review with Claude Code

https://www.youtube.com/watch?v=1K_4QqUlSBU
1•nialse•1m ago•0 comments

GitHub Actions and Consequences

https://tylercipriani.com/blog/2026/04/24/on-the-software-supply-chain-doom-spiral/
1•thcipriani•2m ago•0 comments

CAD in Codex

https://twitter.com/soft_servo/status/2047436911657025858
1•softservo•3m ago•1 comments

How to Kill a Philosophical Zombie

https://sopathaye.substack.com/p/how-to-kill-a-philosophical-zombie
1•sopathaye•3m ago•0 comments

Getting Gray with the Internet Liberation Front

http://grayareasmagazine.com/ilf7.htm
1•Cider9986•7m ago•0 comments

When "Hackers" Was Hacked

https://ironicsans.ghost.io/when-hackers-was-hacked/
2•Cider9986•7m ago•0 comments

Badvibes – Lint for Vibecoded Slop

https://github.com/marco-trotta1/badvibes
1•muoco-01•11m ago•0 comments

The Urgency of Interpretability

https://darioamodei.com/post/the-urgency-of-interpretability
1•tanelpoder•12m ago•0 comments

Show HN: Cutout is an email alias proxy built on Cloudflare Workers

https://ananthb.github.io/cutout/
2•pcpuser•13m ago•0 comments

A ShaderToy-like playground for ASCII art

https://play.ertdfgcvb.xyz
1•dboon•13m ago•0 comments

Ask HN: Why does Macs don't get heat up and have so long battery life

3•shivang2607•14m ago•0 comments

The Podcast Where You Can Eavesdrop on the A.I. Elite

https://www.nytimes.com/2026/04/26/business/dwarkesh-patel-podcast-ai.html
1•rafaelc•15m ago•0 comments

Show HN: Time Pin – a Geo Guessr style game but history themed

https://www.crazygames.com/game/time-pin
1•AndreiCx•17m ago•0 comments

The world is entering a new era of wildfire

https://www.cnn.com/2026/04/26/climate/chile-wildfire-new-fire-era-intl-latam
2•mooreds•17m ago•0 comments

Man's search for meaning: The case of Legos

https://www.sciencedirect.com/science/article/abs/pii/S0167268108000127
1•mooreds•18m ago•1 comments

Alex Imas on Why Economists Might Be Getting AI Wrong – Odd Lots [video]

https://www.youtube.com/watch?v=uxMwmaGE64Y
1•mooreds•18m ago•0 comments

Tiled Words 6 Month Update

https://paulmakeswebsites.com/writing/six-months-of-tiled-words/
1•paulhebert•18m ago•1 comments

The Monkey Diet Experiment

http://www.nathanedwardwilliams.com/fun/monkeydiet.htm
1•busymom0•19m ago•0 comments

Cost of smoking in England up 25% to and£21.8B (2024)

https://ash.org.uk/media-centre/news/press-releases/latest-figures-show-cost-of-smoking-in-englan...
1•mmarian•23m ago•0 comments

I can never talk to an AI anonymously again

https://www.theargumentmag.com/p/i-can-never-talk-to-an-ai-anonymously
2•voisin•23m ago•0 comments

RuneBench – Agent Benchmark on RuneScape Gameplay Tasks

https://maxbittker.github.io/runebench/
1•rickcarlino•25m ago•0 comments

Cellphone-Location Tracking Poses Privacy Test at Supreme Court

https://www.wsj.com/us-news/law/police-geofence-warrants-phone-location-17d7cbe4
2•Cider9986•28m ago•0 comments

Nuclear Detonation: Weapons, Improvised Nuclear Devices

https://remm.hhs.gov/nuclearexplosion.htm
1•reconnecting•32m ago•0 comments

The Emerging Push to Extend Some US Benefits to IDF Soldiers

https://www.military.com/feature/2026/04/19/emerging-push-extend-some-us-benefits-idf-soldiers.ht...
2•cramsession•32m ago•0 comments

Databricks vs. Snowflake Weekly

https://claude.ai/public/artifacts/eb39f250-4869-4fb3-840d-d49620ee3b51
2•noashavit•35m ago•1 comments

How to remove One UI from a Samsung device?(2025)

https://tinygrab.com/how-to-remove-one-ui-from-a-samsung-device-note-this-is-likely-not-possible-...
1•rolph•36m ago•0 comments

I built a million-pixel canvas where strangers buy individual squares

https://pixel-wall-kofi-s1k3-production.up.railway.app/
1•matthewder•36m ago•0 comments

RLix: A scheduling layer for concurrent LLM RL

https://github.com/rlops/rlix
1•matt_d•36m ago•0 comments