-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: ionic angular, karma tests not waiting for ionic to load on live-reloads #22853
Comments
Thanks for the issue. Can you provide a GitHub repo that shows this issue happening? I have a blank starter app with an |
Thanks for the issue! This issue has been labeled as Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed. If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue. For a guide on how to create a good reproduction, see our Contributing Guide. |
Hey @liamdebeasi, thanks for the quick response. I now realized that the error only occurs under certain conditions:
i is rather complicated for me to share a project via github since i am in a corporate network. If you still have issues reproducing it, please let me now. |
Sorry for the delay. Are you able to reproduce this in an Ionic starter app and share a link if possible? I tried adding 2 |
Hi @liamdebeasi, please have a look at https://github.com/bohndthi/ionic-bug |
Thanks! I can reproduce this. The issue seems to be that the tests are not waiting for Ionic Angular to be fully configured when live-reloading the Karma tests. On first test load, |
Same happens for me with ion-radio |
Is there any update? |
1 similar comment
Is there any update? |
Has anyone developed a workaround to this issue? |
When karma runs each test case the window object persists. Ionic does some initial setup in angular first before handing over to core. On each test case in karma angular bootstraps itself again, during this bootstrap we set Ionic.config. On the first test case this is fine as Ionic core is also bootstrapped but on the second test case this overwrites legitimate config which causes parts of Ionic to fail as the config is no longer in the expected format. This fix works by only setting Ionic.config if it does not already exist. If it does exist then we do not replace it with an object thats not compatible with core. There may be better ways to solve this issue but I didn't want to change too much of ionic/angular so this felt like the safest change
Thanks for the issue. This has been resolved via #24004, and a fix will be available in an upcoming release of Ionic Framework. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Bug Report
Ionic version:
[x] 5.x
Current behavior:
If a page contains an ion-segment, the karma tests throws an long error message:
Expected behavior:
no long error messages
Steps to reproduce:
Ionic info:
@ionic/angular: 5.5.3
The text was updated successfully, but these errors were encountered: