-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Testing with Jasmine - Async object not exists #2564
Comments
It doesn't seem like Rx issue, jasmine seems try to be smart to catch some of unexpected exceptions thrown, and it's shallowed somehow. So in your test code, it asserts expect(obj.data.length).toBe(100); and instead, if you make
now you can see test fails. If you change your assertion like below, try {
const a = obj.data.length;
expect(a).toBe(100);
} catch (e) {
console.log(e);
} you can see exception more clear like It is hard to say what makes this causes exactly though, my current assumption is it's somewhat unrelated to Rx's regression - if you're throwing unhandled exception in observer callbacks, Observable can't do lot of things pretty much. |
Sure i can set the Array to a default value. But if i do a async call to an api it could be taht the "data" is not existing. If that is the case it should be fail. And not pass as it does right now. Do you think i should open an issue on jasmin project? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version:
5.3.0
Code to reproduce:
https://github.com/nischi/angular-testing
angular/angular#15889
Expected behavior:
Test should fail because array do not exists
Actual behavior:
Test pass
Additional information:
angular/angular#15889
I have discussed that with the angular team, but they said its a problem with rxjs and jasmine not angular itself, thats the reason why i put the issue here as well.
The text was updated successfully, but these errors were encountered: