If you find the companies you're interviewing with consistently fail your test, then bring your pattern-identifying skills to bear and figure out why. Maybe all of the companies you're interviewing at have something in common (they're all startups, they're all Fortune 500s, the CEO isn't technical, the roles are too senior/junior). In which case you should break the pattern and apply for work at different types of companies.
Or possibly the pattern lies within yourself. Do you consistently fail the same kind of technical tests? Does your answer to a specific question ("Can you show us a large codebase you've worked on? Oh, you can't?") tend to elicit the same negative answer? Then maybe you should focus on strengthening those weaknesses.