bug: Ionic Angular was already initialized. Make sure IonicModule.forRoot() is just called once.
See original GitHub issueBug Report
Ionic version: [x] 4.x
Current behavior: Create a new ionic angular app. Run the tests.
Expected behavior: No warnings would be displayed.
This becomes more pervasive as the test suite grows. I see this warning numerous times throughout my real apps. Why is it there and how do we remove it? Is the generator setting up tests incorrectly?
Steps to reproduce: git clone https://github.com/josh-m-sharpe/bareCapacitorApp.git yarn install npm run test
> bareCapacitorApp@0.0.1 test /Users/jsharpe/bareCapacitorApp
> ng test
10% building 1/1 modules 0 active16 11 2019 06:46:05.349:WARN [karma]: No captured browser, open http://localhost:9876/
16 11 2019 06:46:05.420:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
16 11 2019 06:46:05.420:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
16 11 2019 06:46:05.426:INFO [launcher]: Starting browser Chrome
16 11 2019 06:46:13.256:WARN [karma]: No captured browser, open http://localhost:9876/
16 11 2019 06:46:13.490:INFO [Chrome 78.0.3904 (Mac OS X 10.14.6)]: Connected on socket YbYWbp2Wnno-nsT5AAAA with id 37625611
Chrome 78.0.3904 (Mac OS X 10.14.6): Executed 0 of 6 SUCCESS (0 secs / 0 secs)
16 11 2019 06:46:16.551:WARN [web-server]: 404: /svg/md-book.svg
16 11 2019 06:46:16.553:WARN [web-server]: 404: /svg/md-build.svg
16 11 2019 06:46:16.555:WARN [web-server]: 404: /svg/md-grid.svg
WARN: 'Ionic Angular was already initialized. Make sure IonicModule.forRoot() is just called once.'
Chrome 78.0.3904 (Mac OS X 10.14.6): Executed 1 of 6 SUCCESS (0 secs / 0.465 secs)
WARN: 'Ionic Angular was already initialized. Make sure IonicModule.forRoot() is just called once.'
Chrome 78.0.3904 (Mac OS X 10.14.6): Executed 2 of 6 SUCCESS (0 secs / 0.698 secs)
Chrome 78.0.3904 (Mac OS X 10.14.6): Executed 4 of 6 SUCCESS (0 secs / 0.954 secs)
16 11 2019 06:46:17.093:WARN [web-server]: 404: /svg/md-flash.svg
16 11 2019 06:46:17.096:WARN [web-server]: 404: /svg/md-apps.svg
Chrome 78.0.3904 (Mac OS X 10.14.6): Executed 6 of 6 SUCCESS (1.07 secs / 0.995 secs)
TOTAL: 6 SUCCESS
TOTAL: 6 SUCCESS
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Error: Found multiple IonicModule.forRoot calls in"imports ...
IonicModule.forRoot(appRoot, config, deepLinkConfig) is set the root app component for you IonicModule. If you set it, you may need remove ...
Read more >Ionic 4 - Service at root
Hi, I'm trying to have a service that could be shared across my pages. I've imported it in the providers but it still...
Read more >Getting started with standalone components - Angular
Components, directives, and pipes can now be marked as standalone: true . Angular classes marked as standalone do not need to be declared...
Read more >Using Background Geolocation in Ionic 5 Angular Apps
Once our application is successfully built, we can implement our logic and make the plugin do the work. We have to make sure...
Read more >firebase app named '[default]' already exists - You.com
If you want to use that script to automatically initialize Firebase, then you don't need to call initializeApp manually. Just make sure your...
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
@Rajatsoni9 if only IonicModule is used it will not build up the Shadow DOM correctly. Then a lot of things, like the text content of ion-text-area, cannot be tested.
These warnings are due to multiple calls to
IonicModule.forRoot()
in each test suite. If you replace it with justIonicModule
in theimports
array in the testing module, the warnings disappear.