Mine is that the useState hook is an actual plague on the entire React ecosystem. Regardless of your opinions of React, if you wanna use something then use it right.
Mine is that the useState hook is an actual plague on the entire React ecosystem. Regardless of your opinions of React, if you wanna use something then use it right.
You’ll eventually have to run these 10 hours no matter what. If you only run the unit tests you won’t be able to tell if your code actually works, and if your full e2e suite passes then you won’t learn anything of value from running the unit tests - if one of them fails you can be fairly certain that it is that unit test itself that is broken, not the product.
During development, you don’t need to run the full test suite. It’s usually quite trivial to identify a single integration test that checks the parts you are touching, and then you only have to run it to see the effects of your changes.
Integration tests rarely (if ever) need mocks. If they need Test Doubles at all, they’d typically be _Fake_s rather than _Mock_s. But even that is not always needed - an integration test can often just use non-production versions of the real dependencies.
So - if your real software typically runs against a database that sits on a powerful server and has tables with billions of rows, the e2e tests can use the same database engine but run it locally and only put a few dozens of rows in these tables. This setup is quick and cheap to set up and tear down while still being faithful to the production setup - maybe not 100%, but orders or magnitude more faithful than a unit test’s mock that just compares the SQL commands given to it with the ones preprogrammed into it.
My argument is that this is more about the “problem domain” than about the “solution domain”. Some field of software work very neatly with unit tests - general libraries are a good example. Other fields are a very poor fit, and trying to shoehorn them into using unit tests - even worse, shoehorning them into using mostly unit tests - will inevitable result in a nightmare of mock maintenance.
The problem is that unit tests “promote” aspects of implementation into behavior. Classic example - the exact syntax of the SQL query a function uses to obtain the data it needs is by all rights an implementation detail, but a unit test is forbidden from using a real database so it passes a mock that expects a very specific query - now it became a behavior.