ciena-blueplanet / ember-test-utils

A set of utilities to aid in testing components
MIT License
5 stars 18 forks source link

Error when using helper function from setup-test.js in Ember CLI 2.12.3 #91

Open juwara0 opened 7 years ago

juwara0 commented 7 years ago

When using the helper function https://github.com/ciena-blueplanet/ember-test-utils/blob/265973b92d856615dee92e5ec2368b1170b5111f/addon-test-support/setup-test.js#L154 from setup-test.js in an add-on running Ember CLI 2.12.3 the following error is thrown:

Error: You attempted to access "compute" on a factory manager created by container#factoryFor. "compute" is not a member of a factory manager."
    at Object.get (assets/vendor.js:17119:21)
    at Object.options.subject (assets/test-support.js:37466:21)
    at Context.context.(anonymous function) [as subject] (assets/test-support.js:36892:39)
    at Context.<anonymous> (assets/tests.js:2828:22)
    at assets/test-support.js:37633:25
    at Backburner.run (assets/vendor.js:16438:23)
    at Object.run (assets/vendor.js:38436:27)
    at Context.<anonymous> (assets/test-support.js:37631:24)
    at invoke (assets/test-support.js:22185:21)
    at Context.asyncFn (assets/test-support.js:22170:11)
notmessenger commented 7 years ago

@notmessenger can provide a failing example

notmessenger commented 7 years ago

Notes anyone can ask me about

  https://github.com/emberjs/data/commit/0ab7698fffe3c4b51646bb1b72207685c95c78fb

  _modelFactoryFor(modelName) {
    heimdall.increment(modelFor);
    let factory = this._modelClassCache[modelName];

    if (!factory) {
      factory = this.modelFactoryFor(modelName);

      if (!factory) {
        //Support looking up mixins as base types for polymorphic relationships
        factory = this._modelForMixin(modelName);
      }
      if (!factory) {
        throw new EmberError(`No model was found for '${modelName}'`);
      }

      // interopt with the future
      let klass = getOwner(this).factoryFor ? factory.class : factory;

      assert(`'${inspect(klass)}' does not appear to be an ember-data model`, klass.isModel);

      // TODO: deprecate this
      klass.modelName = klass.modelName || modelName;

      this._modelClassCache[modelName] = factory;
    }

    return factory;
  },

https://github.com/ember-intl/ember-intl/commit/4cf6669791f661856199cae4293caa0d5028ad83

-    const Klass = owner.factoryFor('model:ember-intl-translation') || Translation;    +    let Klass;
 -    const ModelKlass = Klass.extend();     +    if (owner.hasRegistration('model:ember-intl-translation')) {

 +      Klass = owner.factoryFor('model:ember-intl-translation').class;
 +    } else {
 +      Klass = Translation;
 +    }

 +    const ModelKlass = Klass.extend();

https://github.com/scoutforpets/ember-fullcalendar/pull/44/files
https://github.com/scoutforpets/ember-fullcalendar/issues/43

-    const applicationConfig = getOwner(this)._lookupFactory('config:environment');
+    const applicationConfig = getOwner(this).resolveRegistration('config:environment');