DEV Community

Discussion on: The Convenience of Faker

Collapse
 
kwstannard profile image
Kelly Stannard

There is an anti-pattern with Faker that I would like to spread awareness of.

Don't use Faker in your tests. It might seem like a fun way to avoid uniqueness constraints, but eventually Faker will repeat itself and fail a test. I have probably had to remove Faker calls a half dozen times due to this. Use an infinite sequence in tests instead.

Faker is great for populating an MVP or prototype though.