Can't resolve components for integration tests
See original GitHub issueWhen 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
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
How would this be fixed with
ember@2.12
andember-engines@0.5.4
? It seems that the problem is still present andember-engines/resolver
has been removed. Which deprecates the fix proposed above.@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 😕