Jasmine 2.0 Async Beforeeach Not Waiting For Async To Finish
I am using Jasmine 2.0 and require.js. I cannot get the async tests to work properly when I put the async code in a beforeEach function. My it statement is still running before the
Solution 1:
Local require var should have another name to be wrapped to the outside scope. Also in the "it" you do not require done, it is only in the async part. Something like this must work:
describe("App Model :: ", function() {
var AppModel;
beforeEach(function(done) {
require(['models/appModel'], function(_AppModel) {
AppModel = _AppModel;
done();
});
});
it("should exist", function() {
var appModel = new AppModel()
expect(appModel).toBeDefined();
});
});
Post a Comment for "Jasmine 2.0 Async Beforeeach Not Waiting For Async To Finish"