Failed unit test with routes
See original GitHub issueAt dummy I have the mounted engine:
this.mount('apollo-enterprise', { as: 'enterprise', path: '/enterprise' });
When I run the tests I get the follow issue:
not ok 47 PhantomJS 2.1 - Unit | Route | reports: it exists
---
actual: >
null
expected: >
null
stack: >
missingModule@http://localhost:7357/assets/vendor.js:233:93
findModule@http://localhost:7357/assets/vendor.js:244:20
findDeps@http://localhost:7357/assets/vendor.js:178:34
findModule@http://localhost:7357/assets/vendor.js:248:19
requireModule@http://localhost:7357/assets/vendor.js:31:25
_extractDefaultExport@http://localhost:7357/assets/vendor.js:95146:27
resolveOther@http://localhost:7357/assets/vendor.js:94862:53
superWrapper@http://localhost:7357/assets/vendor.js:51453:27
resolveRoute@http://localhost:7357/assets/vendor.js:16051:31
resolve@http://localhost:7357/assets/vendor.js:15895:43
_setupIsolatedContainer@http://localhost:7357/assets/test-support.js:7071:66
setupContainer@http://localhost:7357/assets/test-support.js:6892:39
http://localhost:7357/assets/test-support.js:5817:32
initializePromise@http://localhost:7357/assets/vendor.js:69693:15
Promise@http://localhost:7357/assets/vendor.js:70181:50
nextStep@http://localhost:7357/assets/test-support.js:5816:54
invokeSteps@http://localhost:7357/assets/test-support.js:5823:24
setup@http://localhost:7357/assets/test-support.js:5770:32
beforeEach@http://localhost:7357/assets/test-support.js:5614:34
callHook@http://localhost:7357/assets/test-support.js:1478:26
runHook@http://localhost:7357/assets/test-support.js:1472:15
advance@http://localhost:7357/assets/test-support.js:1112:26
begin@http://localhost:7357/assets/test-support.js:2762:27
http://localhost:7357/assets/test-support.js:1970:11
message: >
Promise rejected before "it exists": Could not find module `apollo-enterprise/routes/reports` imported from `dummy/routes/reports`
Log: |
...
ok 48 PhantomJS 2.1 - ESLint - unit/routes/reports-test.js: should pass ESLint
Any idea how solve it? Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Angular Unit testing : Error: Cannot match any routes. URL ...
When you want to unit test your router, you have to use the testing module, not the actual one. Start with import {...
Read more >Route TestKit • Akka HTTP - Documentation
For services built with the Routing DSL Akka HTTP provides a dedicated testkit that makes efficient testing of route logic easy and convenient....
Read more >Unit test controller logic in ASP.NET Core
A controller unit test avoids scenarios such as filters, routing, and model binding. Tests that cover the interactions among components that ...
Read more >Testing
Testing. React Router relies on React context to work. This affects how you can test your components that use our components.
Read more >getting error trying to unit test my app-route.module.ts #30631
I have an application that hosts 2 other application (a website and dashboard) for my mian application I either redirect to website or ......
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
We have unit tests working now with two changes, with lazy loaded engines:
It’s necessary to re-export pieces (routes, components, etc) in the
app
directory, for the purposes for testing.In
tests/index.html
this order worked:@majew7 I was able to get my unit tests working in a slightly different way, not any better IMO.
I was able to use the
ember-engines/test-support/engine-resolver-for
module, as specified in the README. The README states its for in-repo-engines, but I’m using it for a stand-alone engine (not sure if that’s due to some other issue I could have 😟).Also, adding re-exports in the app directory caused module lookup issues when running the engine stand-alone and the engine’s tests.
I had to do the same.