Open rednotice opened 3 years ago
I'm having the same issue. This code mirrors the tutorial, so I'm confused.
Hi! Try to import factory with this way:
const factory = require('factory-bot').factory;
it worked on me. Also don't forget to create a model as well
I'm having a similar issue, but it's with factory.FactoryGirl is not a constructor
:
const FactoryBot = require('factory-bot')
const factory = FactoryBot.factory
const pgFactory = new factory.FactoryGirl() // Reports factory.FactoryGirl is not a constructor
Identical code worked previously with factory-girl, just trying to replace factory-girl w/ factory-bot, but am stuck with the above.
I tried to use factory-bot like this:
But got an error:
TypeError: factory.define is not a function
Please help me :( How do I import and use this as ES6 modules?