-
Notifications
You must be signed in to change notification settings - Fork 66
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
Support Angular4 Testability #49
Comments
I am wondering - would mocking your LD service help? |
summary events (4): break HTTP logic out of event processor, add tests for both
Unfortunately, no. Angular Testability is for e2e tests (using frameworks such as protractor), so mocking the LD service is not really an option. |
My current workaround is to add backdoor hooks in my LD service that check special flags in localStorage and not initialise launch-darkly client. So before all the tests I'll need to:
It would be awesome if the library can be enhanced to play nice with Angular Testability |
It works fine if you initialize Launch Darkly outside of Angular (in callback of |
Hi all, We don't currently have any Angular-specific support in our JavaScript SDK and we don't have any plans to change this. Consequently I'm going to close this issue now; I'm hopeful that @mpienkowski's solution works for others. Cheers, |
When integrating ldclient-js with an Angular4 application, the Angular4 Testability service is not usable as the testability never becomes stable after an ldclient is initialized.
For example,
window.getAllAngularTestabilities()[0].isStable()
is always false.The testability is considered "stable" when there are no "macro tasks" still pending. According to this, The
setTimeout
calls used by the ld client are macro tasks, and because the ld client uses an infinite loop ofsetTimeout
calls there is always a macro task pending, and therefore the testability is never stable.A similar issue exists when using angular-google-maps with the testability service: sebholstein/angular-google-maps#815
I'm no JS expert so I'm not sure how this could be solved - do we need a separate client library that specifically targets Angular4?
The text was updated successfully, but these errors were encountered: