I\'m trying to run some JavaScript code using jasmine and Resharper 7 within visual studio 2012. I follow the AMD pattern with the aid of requirejs. However, i haven\'t mana
Use a named requireJS Module
define("my/sut", function () {
var MySut = function () {
return {
answer: 42
};
};
return MySut;
});
And initialize the SUT with the asyncronus support of Jasmine. Don't forgot the references!
///
///
describe("requireJS with Jasmine and Resharper", function () {
it("should be executed", function () {
// init SUT async
var sut;
runs(function () {
require(['my/sut'], function (MyModel) {
sut = new MyModel();
});
});
waitsFor(function () {
return sut;
}, "The Value should be incremented", 100);
// run the test
runs(function () {
expect(sut.answer).toBe(42);
});
});
});
I hope this works with more modules. In my case it worked with waitsFor '0' ms.