Hilariously enough it can even vary within states. EG: AFAIK, only two counties in Washington state require emissions testing on a semi-regular basis, and nowhere requires safety inspections.
I got burned by this by moving to one of the two counties with an otherwise innocuous check engine light that would have failed the emissions test so I had to get it fixed.
Many states do require similar annual inspections. The standards of those inspections vary widely, however.