I agree with other answers about foundry's speed, it is incredible, as is its reandomization testing and its debugging options. So, if you need fast tests or are stuck on an error, quickly (and easily) set up foundry and test what you need. Otherwise, stick with hardhat.
A little background - we were using hardhat in our projects and when I learned about foundry, I was very excited and started studying it. In the beginning, it was fun - project setup, scripting, testing, it's all easy af. But:
- larger tests are ugly, as no one really likes writing/reading code in low level code like solidity;
- some tests take a lot of effort and kind of make no sense to write, as solidity is not a general purpose language. Imagine you'd have to test something that needs public keys derived from random private keys. It makes no sense to write that code in solidity, and you'd be the first one writing it. Also, try testing zero-knowledge proofs with foundry, remember to implement proof construction... that no one can ever actually use because too much gas;
- don't underestimate npm, it has everything you need to test/script with, openzeppelin/solmate/... on the other hand... help yourself with all the erc#### implementations;
- I got confused by solidity code no longer serving as smart contract code; especially with scripting - those lines are not executed in one transaction. And I can't stress this enough... it is not good to be confused when writing Solidity code;
- had issues with submodules as foundry wanted to compile EVERYTHING. It was fun having repositories with multiple solidity versions and their own ERC20 modifications all called
ERC20.sol. Just install repos via npm and it compiles what it needs (I admit this can be solved by Foundry folks soon);
vm.startPrank(address(0)); // code; vm.endPrank(); - yeah you can send funds from zero-address, great, but contract.method({ from: logicalAddress });
- testing Solidity does not necessarily make sense to be done in Solidity - you are deploying contracts and interacting with them from a local machine that is not running evm. So it makes sense to test this from another language.
So, in the end, typescript with typechain > solidity, you can't test whatever you want in Foundry, you can use both. Foundry is great, but it is overhyped and cannot replace hardhat in larger projects.