Code Monkey home page Code Monkey logo

Comments (5)

pfmmfp avatar pfmmfp commented on May 22, 2024 1

How would this be fixed with [email protected] and [email protected]? It seems that the problem is still present and ember-engines/resolver has been removed. Which deprecates the fix proposed above.

from ember-engines.

trentmwillis avatar trentmwillis commented on May 22, 2024

Sounds like an issue with how the test's Resolver is set up. In tests/test-helper.js you should see a call to setResolver, this sets the Resolver instance that is used by Integration/Unit tests, by default it pulls in a resolver from tests/helpers/resolver.js that looks something like:

import Resolver from '../../resolver';
import config from '../../config/environment';

const resolver = Resolver.create();

resolver.namespace = {
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix
};

export default resolver;

You'll want to make sure the Resolver class it is importing is extended from ember-engines/resolver (or, more ideally, is the same Resolver used by your Engine). Additionally, you'll probably need to update modulePrefix to be the same as whatever your Engine's modulePrefix is (looks like testmanager-engine) otherwise it'll likely be the dummy namespace (assuming this is an Addon).

So in other words, make sure the Resolver is looking in the proper namespace for your component.

Bonus tip: the reason you see A helper named 'foo-component' could not be found. is that during rendering of templates, Ember first attempts to resolve Handlebars constructs as Components and then Helpers. So, if a Component is not found (as in this case) it tries to resolve it as a Helper, but if no Helper is found it'll throw the error you are seeing.

from ember-engines.

caseklim avatar caseklim commented on May 22, 2024

For anyone else encountering this issue:

  1. tests/dummy/app/resolver.js should be extended from ember-engines/resolver
  2. modulePrefix in tests/helpers/resolver.js should be set to the same modulePrefix as your engine

We haven't thought of a way to avoid hard-coding modulePrefix inside of tests/helpers/resolver.js, but the above steps resolve this issue at least

@Kaceykaso

from ember-engines.

dgeb avatar dgeb commented on May 22, 2024

Thanks for the update @cklimkowsky

We haven't thought of a way to avoid hard-coding modulePrefix inside of tests/helpers/resolver.js, but the above steps resolve this issue at least

As of ember-engines v0.2.5 (from the v0.2 branch), you should be able to import the same config/environment into both your addon/engine.js and your tests/helpers/resolver.js, and then access its value as config.modulePrefix. In other words, you should no longer need to hard-code modulePrefix in multiple places. Note: if you're using Ember Canary, you can also have this same benefit by using the ember-engines clean branch, which is soon to merge with master.

from ember-engines.

Kaceykaso avatar Kaceykaso commented on May 22, 2024

@dgeb we can import it everywhere without issues EXCEPT in tests/helpers/resolver.js; that is still throwing errors on the vanilla unit test Ember generates with a route:
Promise rejected before it exists: Attempting to register an unknown factory: 'route:plans/new'

We are using Ember 2.7.0-canary :-/

from ember-engines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.