-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 question - why do promises magically run synchronously #2900
Comments
yeah, I think the Karma logger will on rare occasion log things out of order, that's not good because I run it now, and it logs it correctly. |
Maybe improve the logging order, idk, will close |
Async code in tests requires different test API. Try it('should update a comment by 59dd58092889e25745b6b208', function () {
//expectGET to make sure this is called once.
var url = encodeURI('/api/v1/comments/by_id/59dd58092889e25745b6b208');
httpBackend.expectPUT(url, options1.data).respond(comments1);
console.log('uno');
var promise = myService.updateComment(options1.data).then(function (response) {
expect(response.value).to.equal(comments1[0].value);
console.log('dos');
});
//flush the backend to "execute" the request to do the expectedGET assertion.
httpBackend.flush();
console.log('tres');
return promise; or it('should update a comment by 59dd58092889e25745b6b208', function (done) {
//expectGET to make sure this is called once.
var url = encodeURI('/api/v1/comments/by_id/59dd58092889e25745b6b208');
httpBackend.expectPUT(url, options1.data).respond(comments1);
console.log('uno');
myService.updateComment(options1.data).then(function (response) {
expect(response.value).to.equal(comments1[0].value);
console.log('dos');
done();
});
//flush the backend to "execute" the request to do the expectedGET assertion.
httpBackend.flush();
console.log('tres'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forgive me, I am a bit of newb with Karma + Jasmine
I am sure there is an simple answer to this.
I have the following Jasmine code with Karma:
Expected behaviour
I would expect it to log:
Actual behaviour
Environment Details
karma --version
):karma.config.js
fileSteps to reproduce the behaviour
See screenshot:
The text was updated successfully, but these errors were encountered: