I just upgraded to Jquery 3.6.0 and when I try to run the tests they fail. What I found is that when I call fakeserver.respond() instead of the program continuing in the callback functions the test finishes first failing obviously and after that the actual functions are called. So basically every thing is called it's just the order that is messed up. Is there a way to run these tests synchronously instead of their current async behavior?
I am using sinon 1.17.7 with node 8.9.0 it's a legacy project we can't update node version.
Edit:
I tried updating the sinon version but with every version updated more and more tests fail.
Here is an example of a test that was working with older version of jquery. Note that this code is just an example not the actual code. So with the old version of jquery after fakeserver.respond was called the execution continued in SomeView callback and after everything was finished then it went on to check the expect condition. With the new version of jquery after fakeserver.respond is called it first checks the expect condition and then moves on to SomeView callback funtions.
var fakeserver;
beforeEach( function() {
fakeserver = sinon.fakeServer.create();
}),
afterEach(function () {
fakeServer.restore();
});
it('Should show element after request' , function() {
SomeView.render();
var response = {
someDataWeNeed: { data: someString }
};
fakeServer.respondWith('GET', someUrl, JSON.stringify(response))
fakeServer.respond();
expect( SomeView.$el).toBeInDOM();
}),