{"id":169699,"date":"2013-02-17T18:57:03","date_gmt":"2013-02-17T14:57:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=169699"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=169699","title":{"rendered":"<span class=\"post_title\">Jasmine \u2014 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/f3a\/d03\/860\/f3ad038603da2987981c8ada37a3476c.png\" align=\"left\"\/>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/167173\/\">\u00ab\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Jasmine\u00bb<\/a>. \u0417\u0434\u0435\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"http:\/\/pivotal.github.com\/jasmine\/\">Jasmine<\/a>, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<ul>\n<li>Spy \u2014 \u044d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439\/\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/li>\n<li>Clock \u2014 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 setTimeout\/setInterval<\/li>\n<li>Runner \u0438 Reporter \u2014 \u0437\u0430\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0430 \u0434\u043b\u044f \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c CoffeeScript (<a href=\"https:\/\/github.com\/inex-finance\/blog-examples\/blob\/master\/jasmine\/javascripts\/spec\/advanced.js\">\u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 JavaScript<\/a>).<\/p>\n<p>  \u0412 Jasmine \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>spyOn<\/b>. \u0424\u0443\u043d\u043a\u0446\u0438\u0438 spyOn \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"coffeescript\">  spyOn(window, 'isNaN') <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 spyOn \u0432\u044b\u0437\u043e\u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 Person:<\/p>\n<pre><code class=\"coffeescript\">class Person  name: null  age:  0  constructor: (@name, @age) -&gt;  getName: -&gt; @name  setName: (value) -&gt; @name = value  getAge: -&gt; @age  addYear: -&gt; @age += 1 <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <b>spyOn<\/b> \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"coffeescript\">describe &quot;Spy&quot;, -&gt;  person = null   beforeEach -&gt;    person = new Person(&quot;Jim&quot;, 25)   it &quot;\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438&quot;, -&gt;    spyOn(person, 'getName')    person.getName()    expect(person.getName).toHaveBeenCalled()   it &quot;\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432&quot;, -&gt;    spyOn(person, 'addYear')    person.addYear()    person.addYear()    expect(person.addYear.calls.length).toEqual(2)   it &quot;\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432&quot;, -&gt;    spyOn(person, 'setName')    person.setName(&quot;Ira&quot;)    expect(person.setName).toHaveBeenCalledWith(&quot;Ira&quot;) # \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432      it &quot;\u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443&quot;, -&gt;    spyOn(person, 'setName')    person.setName(&quot;Ira&quot;)    expect(person.setName.mostRecentCall.args[0]).toEqual(&quot;Ira&quot;)   it &quot;\u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430\u043c&quot;, -&gt;    spyOn(person, 'setName')    person.setName(&quot;Ira&quot;)    expect(person.setName.calls[0].args[0]).toEqual(&quot;Ira&quot;) <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 spyOn \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <b>andCallThrough<\/b>, \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d \u0432\u044b\u0437\u043e\u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"coffeescript\"> it &quot;\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e&quot;, -&gt;    spyOn(person, 'getName').andCallThrough()    expect(person.getName()).toEqual(&quot;Jim&quot;)    expect(person.getName).toHaveBeenCalled() <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c spyOn \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <b>andReturn<\/b>:<\/p>\n<pre><code class=\"coffeescript\"> it &quot;\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&quot;, -&gt;    spyOn(person, 'getName').andReturn(&quot;Dan&quot;)    expect(person.getName()).toEqual(&quot;Dan&quot;)    expect(person.getName).toHaveBeenCalled() <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 spyOn \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <b>andCallFake<\/b>, \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<pre><code class=\"coffeescript\"> it &quot;\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e&quot;, -&gt;    spyOn(person, 'getAge').andCallFake(-&gt; return 5 * 11)    expect(person.getAge()).toEqual(55)    expect(person.getAge).toHaveBeenCalled() <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0435\u0437 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <b>createSpy<\/b>, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e spy. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 createSpy \u2014 \u044d\u0442\u043e \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"coffeescript\"> it &quot;\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0444\u0430\u043b\u044c\u0448\u0438\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e&quot;, -&gt;    concat = jasmine.createSpy('CONCAT')    concat(&quot;one&quot;, &quot;two&quot;)    expect(concat.identity).toEqual('CONCAT') # \u0435\u0441\u0442\u044c \u0438\u043c\u044f \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438    expect(concat).toHaveBeenCalledWith(&quot;one&quot;, &quot;two&quot;)    expect(concat.calls.length).toEqual(1) <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>createSpyObj<\/b>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 createSpyObj \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u043c\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438:<\/p>\n<pre><code class=\"coffeescript\"> it &quot;\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0444\u0430\u043b\u044c\u0448\u0438\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442&quot;, -&gt;    button = jasmine.createSpyObj('BUTTON', ['click', 'setTitle', 'getTitle'])    button.click()    button.setTitle(&quot;Help&quot;)    expect(button.click).toBeDefined()    expect(button.click).toHaveBeenCalled()    expect(button.setTitle).toHaveBeenCalledWith(&quot;Help&quot;)    expect(button.getTitle).not.toHaveBeenCalled() <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c <b>jasmine.any<\/b>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f:<\/p>\n<pre><code class=\"coffeescript\"> it &quot;\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u0438\u043f&quot;, -&gt;    spyOn(person, 'setName')    person.setName(&quot;Ira&quot;)    expect(person.setName).toHaveBeenCalledWith(jasmine.any(String)) <\/code><\/pre>\n<p>  \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 setTimeout\/setInterval \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <b>jasmine.Clock.useMock<\/b>. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <b>jasmine.Clock.tick<\/b>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445:<\/p>\n<pre><code class=\"coffeescript\">describe &quot;\u0412\u0440\u0435\u043c\u044f&quot;, -&gt;  callback = null    beforeEach -&gt;    callback = jasmine.createSpy('TIMER')    jasmine.Clock.useMock()      it &quot;\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 timeout \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e&quot;, -&gt;    setTimeout((-&gt; callback()), 100) # \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 100ms    expect(callback).not.toHaveBeenCalled()    jasmine.Clock.tick(101) # \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 101ms    expect(callback).toHaveBeenCalled() <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 Jasmine, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"coffeescript\"># \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 jasmineEnv = jasmine.getEnv() jasmineEnv.updateInterval = 250 currentWindowOnload = window.onload  window.onload = -&gt;  currentWindowOnload() if currentWindowOnload  execJasmine()  execJasmine = -&gt; jasmineEnv.execute()  # \u0412\u0438\u0434 \u043e\u0442\u0447\u0435\u0442\u0430 htmlReporter = new jasmine.HtmlReporter() jasmineEnv.addReporter(htmlReporter) jasmineEnv.specFilter = (spec) -&gt; htmlReporter.specFilter(spec) <\/code><\/pre>\n<p>  Jasmine \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u043e\u0442\u0447\u0435\u0442\u043e\u0432 \u043e \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0438\u0445 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li><b>HtmlReporter<\/b> \u2014 \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/li>\n<li><b>TrivialReporter<\/b> \u2014 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 (\u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439)<\/li>\n<li><b>ConsoleReporter<\/b> \u2014 \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c (\u0434\u043b\u044f node.js)<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043d\u0430 \u043d\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c.<\/p>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438:<br \/>  <a href=\"https:\/\/github.com\/pivotal\/jasmine\">github.com\/pivotal\/jasmine<\/a> \u2014 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub<br \/>  <a href=\"https:\/\/www.inexfinance.com\/en\/blog\/2013\/2\/17\/jasmine_additional_features\">www.inexfinance.com\/en\/blog\/2013\/2\/17\/jasmine_additional_features<\/a> \u2014 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<br \/>  <a href=\"https:\/\/github.com\/inex-finance\/blog-examples\/tree\/master\/jasmine\">github.com\/inex-finance\/blog-examples\/tree\/master\/jasmine<\/a> \u2014 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0438\u0437 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/169699\/\"> http:\/\/habrahabr.ru\/post\/169699\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/f3a\/d03\/860\/f3ad038603da2987981c8ada37a3476c.png\" align=\"left\"\/>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/167173\/\">\u00ab\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Jasmine\u00bb<\/a>. \u0417\u0434\u0435\u0441\u044c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"http:\/\/pivotal.github.com\/jasmine\/\">Jasmine<\/a>, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<ul>\n<li>Spy \u2014 \u044d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439\/\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/li>\n<li>Clock \u2014 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 setTimeout\/setInterval<\/li>\n<li>Runner \u0438 Reporter \u2014 \u0437\u0430\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-169699","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169699"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169699\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}