ember-data-factory-guy: factory-guy appears to be incompatible with Fastboot

Factory guy’s usage of Mockjax seems to cause Fastboot to fail with:

Cannot read property 'ajax' of undefined
TypeError: Cannot read property 'ajax' of undefined

The error appears to come from this line in mockjax.

Apparently “to use Mockjax as a Node module you MUST provide the factory with a valid version of jQuery and a window object”

Not sure that it’s a good idea to get into shimming jquery functionality in fastboot, though. So maybe best to just avoid pulling mockjax into the fastboot build at all by adding a guard to the app.import() call (or adjusting the conditions on the existing guard)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 35 (13 by maintainers)

Most upvoted comments

I have an update to factory guy in a few days that will work in fastboot. it is a bit change to underlying code, so I am testing it out a bit on my own projects. But will be ready by the weekend.

Don’t feel guilty ( in this case ) because yes, you wanted fastboot support , but i think i had to do it anyway, because it was long overdue for factory-guy. If I still need help on weekend I will let you know.Thanks for the offering of your time. 😄

You’re right Robert. I was sleeping on that one, and realize that this one is hard, because that shim is only needed in fastboot environment ( ugh ) … i know what I have to do now, I just afraid to step in the mud. Putting on my boots anyway.

I see what you mean ( both of you ) but the trick is … how to not load factory-guy in the fastboot build . Not sure how to do that. Any ideas? Maybe it is so easy I am missing it.

I think I should probably fix this issue myself then … since I can probably do it faster and easier. Let me research a bit ( already started ) and see what I can do. Don’t hold breath though. might be big job.