ember-data-factory-guy icon indicating copy to clipboard operation
ember-data-factory-guy copied to clipboard

Factory Guy incompatible with Embroider

Open patocallaghan opened this issue 4 years ago • 4 comments

It appears things are stabilising around Embroider because in the ember-cli 3.25 all newly-created addons will have Embroider testing baked into ember-try by default. I've been experimenting with Embroider and various addons and it appears that ember-data-factory-guy is incompatible with Embroider.

I have a very simple Factory Guy set up in this repo. [Commit adding Embroider + Factory Guy]

When trying to create some factories for a response I get the following error:

vendor.js:22450 Uncaught TypeError: Cannot read property 'build' of undefined
    at eval (factory-guy.js:339)
    at Array.map (<anonymous>)
    at FactoryGuy.buildRawList (factory-guy.js:333)
    at FactoryGuy.buildList (factory-guy.js:304)
    at __webpack_exports__.default.mockFindAll (exposed-request-functions.js:209)
    at __webpack_exports__.default.run (users.js:7)
    at eval (scenario.js:19)
    at Array.forEach (<anonymous>)
    at __webpack_exports__.default.include (scenario.js:19)
    at __webpack_exports__.default.run (main.js:14)

It's worth pointing out this is happening in both Embroider "safe" and "optimized" modes.

I'll be looking into this myself but just logging here in case any else comes across the problem.

patocallaghan avatar Mar 02 '21 16:03 patocallaghan

I need this for the app I work so I'm going to start working on this this week

patocallaghan avatar Apr 06 '21 08:04 patocallaghan

@patocallaghan any progress on this one by any chance?

averydev avatar Sep 16 '21 19:09 averydev

@averydev I'm hoping to work on it in the coming weeks

patocallaghan avatar Sep 16 '21 21:09 patocallaghan

My application is running embroider with ember-data-factory-guy and it seems fine..

It's in compat mode with these settings

return require('@embroider/compat').compatBuild(app, Webpack, {
    // https://github.com/embroider-build/embroider#options
    staticAddonTestSupportTrees: true,
    staticAddonTrees: true,
    staticHelpers: false,
    staticModifiers: false,
    staticComponents: false,
})

Techn1x avatar Jul 05 '23 04:07 Techn1x