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.

bug: Ionic Angular was already initialized. Make sure IonicModule.forRoot() is just called once.

See original GitHub issue

Bug 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:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
KevinBassaDevelopmentcommented, Jan 19, 2020

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

9reactions
Rajatsoni9commented, Jan 13, 2020

These warnings are due to multiple calls to IonicModule.forRoot() in each test suite. If you replace it with just IonicModule in the imports array in the testing module, the warnings disappear.

Read more comments on GitHub >

github_iconTop 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 >

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