#What’s the best practice for sharing fake data factories between unit tests and e2e tests

2 messages · Page 1 of 1 (latest)

vague snow
#

I’m trying to follow the NestJS testing guideline of placing unit tests close to their corresponding source files. In my project, I use fakerjs to generate fake data for testing purposes. These data factories are shared between the unit tests within the src folder and the e2e tests located in the tests folder.
I’m wondering where the shared fake data factories should live — within src, inside tests, or perhaps in a dedicated folder outside of both?

timid aspen
#

I don't think there's a best practise - do what you find the monst convenient while maintaining readability