Jasmine and Requirejs in Resharper 7 -
i'm trying run javascript code using jasmine , resharper 7 within visual studio 2012. follow amd pattern aid of requirejs. however, haven't managed make test run in resharper test runner.
has managed similar that?
use named requirejs module
define("my/sut", function () { var mysut = function () { return { answer: 42 }; }; return mysut; });
and initialize sut asyncronus support of jasmine. don't forgot references!
/// <reference path="~/scripts/require.js"/> /// <reference path="../code/sut.js" /> describe("requirejs jasmine , resharper", function () { it("should executed", function () { // init sut async var sut; runs(function () { require(['my/sut'], function (mymodel) { sut = new mymodel(); }); }); waitsfor(function () { return sut; }, "the value should incremented", 100); // run test runs(function () { expect(sut.answer).tobe(42); }); }); });
i hope works more modules. in case worked waitsfor '0' ms.