simonexmachina / factory-girl

A factory library for node.js and the browser inspired by factory_girl
MIT License
552 stars 86 forks source link

Provide a seed to Chance for repeatability #124

Open destiny-index opened 6 years ago

destiny-index commented 6 years ago

Is it possible to provide a seed to the factory so that running factory.chance will give repeatable results?

The Chance documentation says that a seed can be provided to Chance using new Chance(mySeed) but I'm not sure if there is a way to pass the seed to the instance of Chance that factory-girl uses.

andrewferk commented 6 years ago

Unfortunately, new Chance() appears to be hardcoded and no configurable seed is being provided.

https://github.com/aexmachina/factory-girl/blob/master/src/generators/ChanceGenerator.js#L5