question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't resolve components for integration tests

See original GitHub issue

When I run ember g component foo-component, it generates a file within the addon and app directories. When I try to run the generated test, it fails, saying it can’t find the module. When I delete the component from the app directory (since it’s my understanding an engine shouldn’t have an app directory in the first place), the test interprets the component as a helper and says it can’t be found.

I’ve only encountered this issue with components so far, not sure if the same thing happens with routes, models, etc.

Are there issues with tests at this point, or is there something I’m missing? Thank you!

[npm 05/13/16 2:49:44] not ok 40 PhantomJS 2.0 - Integration | Component | foo component: it renders
[npm 05/13/16 2:49:44]     ---
[npm 05/13/16 2:49:44]         actual: >
[npm 05/13/16 2:49:44]             null
[npm 05/13/16 2:49:44]         stack: >
[npm 05/13/16 2:49:44]              at missingModule (http://localhost:7357/assets/vendor.js:180:93)
[npm 05/13/16 2:49:44]              at findModule (http://localhost:7357/assets/vendor.js:194:30)
[npm 05/13/16 2:49:44]              at reify (http://localhost:7357/assets/vendor.js:124:32)
[npm 05/13/16 2:49:44]              at build (http://localhost:7357/assets/vendor.js:144:15)
                                    ...
[npm 05/13/16 2:49:44]         message: >
[npm 05/13/16 2:49:44]             Died on test #1  at testWrapper (http://localhost:7357/assets/test-support.js:6645:16)
[npm 05/13/16 2:49:44]              at test (http://localhost:7357/assets/test-support.js:6658:44)
[npm 05/13/16 2:49:44]              at http://localhost:7357/assets/tests.js:111:24
[npm 05/13/16 2:49:44]              at exports (http://localhost:7357/assets/vendor.js:93:39)
[npm 05/13/16 2:49:44]              at build (http://localhost:7357/assets/vendor.js:145:17)
[npm 05/13/16 2:49:44]              at findModule (http://localhost:7357/assets/vendor.js:196:14)
[npm 05/13/16 2:49:44]              at requireModule (http://localhost:7357/assets/vendor.js:184:22)
[npm 05/13/16 2:49:44]              at require (http://localhost:7357/assets/test-loader.js:67:16)
[npm 05/13/16 2:49:44]              at loadModules (http://localhost:7357/assets/test-loader.js:58:25)
[npm 05/13/16 2:49:44]              at load (http://localhost:7357/assets/test-loader.js:89:35)
[npm 05/13/16 2:49:44]              at http://localhost:7357/assets/test-support.js:6477:20: Could not find module `testmanager-engine/components/foo-component` imported from `dummy/components/foo-component`
[npm 05/13/16 2:57:23] not ok 40 PhantomJS 2.0 - Integration | Component | foo component: it renders
[npm 05/13/16 2:57:23]     ---
[npm 05/13/16 2:57:23]         actual: >
[npm 05/13/16 2:57:23]             null
[npm 05/13/16 2:57:23]         stack: >
[npm 05/13/16 2:57:23]             http://localhost:7357/assets/vendor.js:16524
[npm 05/13/16 2:57:23]         message: >
[npm 05/13/16 2:57:23]             Died on test #2  at testWrapper (http://localhost:7357/assets/test-support.js:6645:16)
[npm 05/13/16 2:57:23]              at test (http://localhost:7357/assets/test-support.js:6658:44)
[npm 05/13/16 2:57:23]              at http://localhost:7357/assets/tests.js:111:24
[npm 05/13/16 2:57:23]              at exports (http://localhost:7357/assets/vendor.js:93:39)
[npm 05/13/16 2:57:23]              at build (http://localhost:7357/assets/vendor.js:145:17)
[npm 05/13/16 2:57:23]              at findModule (http://localhost:7357/assets/vendor.js:196:14)
[npm 05/13/16 2:57:23]              at requireModule (http://localhost:7357/assets/vendor.js:184:22)
[npm 05/13/16 2:57:23]              at require (http://localhost:7357/assets/test-loader.js:67:16)
[npm 05/13/16 2:57:23]              at loadModules (http://localhost:7357/assets/test-loader.js:58:25)
[npm 05/13/16 2:57:23]              at load (http://localhost:7357/assets/test-loader.js:89:35)
[npm 05/13/16 2:57:23]              at http://localhost:7357/assets/test-support.js:6477:20: Assertion Failed: A helper named 'foo-component' could not be found

@kaceykaso

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmmfpcommented, Jun 29, 2017

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

0reactions
Kaceykasocommented, Jun 13, 2016

@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 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 - Stack Overflow
components /PropTest1" ). To solve this, you need to update Webpack config and add a resolve property, which will make Webpack look for...
Read more >
Unable to run tests because Nest can't resolve dependencies ...
Nest can't resolve dependencies of the RoleService (?). Please verify whether [0] argument is available in the current context.
Read more >
A Node.js Guide to Actually Doing Integration Tests - Toptal
The drawback, however, is that unit tests can't cover the interaction between components. This is where integration tests become useful.
Read more >
Testing React.js Hooks And Components: The Missing Piece
This is an integration test because React hooks can't be tested directly - they must be tested via a component. And this particular...
Read more >
6 best practices for integration testing with continuous ...
How do you do integration testing with continuous integration (CI) and DevOps? Here are 6 tips, and how they relate to unit testing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found