-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
57 lines (39 loc) · 8.28 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Zuker Blog]]></title>
<link href="/atom.xml" rel="self"/>
<link href="http://zuker.github.io/"/>
<updated>2014-12-05T21:20:37.334Z</updated>
<id>http://zuker.github.io/</id>
<author>
<name><![CDATA[Leonid Kuzmin]]></name>
<email><![CDATA[[email protected]]]></email>
</author>
<generator uri="http://zespia.tw/hexo/">Hexo</generator>
<entry>
<title><![CDATA[Karmic Challenge: Run Tests With Karma in Internet Explorer on Bamboo Agent]]></title>
<link href="http://zuker.github.io/2014/12/05/Karmic-Challenge-Run-Tests-with-Karma-in-Bamboo-Agent/"/>
<id>http://zuker.github.io/2014/12/05/Karmic-Challenge-Run-Tests-with-Karma-in-Bamboo-Agent/</id>
<published>2014-12-05T12:22:29.000Z</published>
<updated>2014-12-05T21:08:01.000Z</updated>
<content type="html"><![CDATA[<p>Recently I’ve finished work on small client-side JavaScript library, a simple REST API client, tests for this lib are running with <a href="http://karma-runner.github.io/" target="_blank" rel="external">Karma</a> and <a href="https://github.com/mochajs/mocha" target="_blank" rel="external">mocha</a>. I’m using Ubuntu on my laptop so it was not possible to run tests in IE during development, but luckily we have <a href="https://www.atlassian.com/software/bamboo" target="_blank" rel="external">Bamboo</a> as CI server in our company with build agents on Windows vm’s. So plan seemed to be plain and simple: create build job with “karma start” command and collect test reports.<br>But the real world has made its first adjustments. Dedicating Bamboo 5.6.0 build agent to build plan job doesn’t affects plan branches: if you’ve dedicated agent “Win” to job “Test” of plan “My App Build” with branch “dev” and launch “My App Build” branch dev it will be running on first free suitable agent and will not wait for agent “Win”. So I’ve had to dedicate agent to whole build plan.<br>Next problem was mysterious and unpredictable. When npm is running under Windows it is trying to use “%APPDATA%/npm” directory, on Windows 2012 Server with domain logon “%APPDATA%” for user “SYSTEM” (system services, including Bamboo agent, are running with this user by default) is “%SYSTEM%\config\systemprofile\AppData\Roaming\” but there was no “npm” dir and npm was crashing with “Error: ENOENT, stat ‘C:\Windows\config\system32\profile\AppData\Roaming\npm”. I’ve manually created this dir and… Surprise! The same “ENOENT” was here! WTF? I’ve tried to change permissions, owner, creating dir from user “SYSTEM” - nothing helped. I’ve leaved this mystery and changed logon user to “Administrator” for Bamboo agent service and “ENOENT” error gone.<br>It was victory? Not half! Running “npm install” directly from command prompt succeeded. However “npm install” build task failed with error</p>
<figure class="highlight [console]"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm <span class="built_in">ERR</span>! ws@<span class="number">0.4</span><span class="number">.32</span> install: `(node-gyp rebuild <span class="number">2</span>> builderror.<span class="built_in">log</span>) || (<span class="keyword">exit</span> <span class="number">0</span>)`</div><div class="line">npm <span class="built_in">ERR</span>! spawn ENOENT</div></pre></td></tr></table></figure>
<p>Brief googling led me to this <a href="https://github.com/npm/npm/issues/6300" target="_blank" rel="external">issue</a> after trying all suggested workarounds from comments spawn error was still there. So, remembering that all worked when running “npm install” manually, I’ve turned off Bamboo agent service and ran agent jar directly from Windows Task Scheduler as startup task. Packages install problem gone.<br>Finally build plan reached “karma start” task. Tests run in Firefox and Chrome was flawless, but some test cases in IE 10 were broken with error “This function is not supported on this system.” referencing to string 9 of <a href="http://sinonjs.org/" target="_blank" rel="external">sinon.js</a> “functionToString” function:</p>
<figure class="highlight [javascript]"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div></pre></td><td class="code"><pre><div class="line"></div><div class="line">sinon.functionToString = <span class="function"><span class="keyword">function</span> <span class="title">toString</span><span class="params">()</span> </span>{</div><div class="line"> <span class="keyword">if</span> (<span class="keyword">this</span>.getCall && <span class="keyword">this</span>.callCount) {</div><div class="line"> <span class="keyword">var</span> thisValue, prop, i = <span class="keyword">this</span>.callCount;</div><div class="line"></div><div class="line"> <span class="keyword">while</span> (i--) {</div><div class="line"> thisValue = <span class="keyword">this</span>.getCall(i).thisValue;</div><div class="line"></div><div class="line"> <span class="keyword">for</span> (prop <span class="keyword">in</span> thisValue) {</div><div class="line"> <span class="keyword">if</span> (thisValue[prop] === <span class="keyword">this</span>) {</div><div class="line"> <span class="keyword">return</span> prop;</div><div class="line"> }</div><div class="line"> }</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keyword">return</span> <span class="keyword">this</span>.displayName || <span class="string">"sinon fake"</span>;</div><div class="line">};</div></pre></td></tr></table></figure>
<p>Nothing criminal, a simple comparison. The only reason google gave me was IE 10 <a href="https://connect.microsoft.com/IE/feedback/details/794531/getting-an-exception-this-function-is-not-supported-on-this-system-when-using-localstorage-when-ie-started-under-the-windows-service" target="_blank" rel="external">bug</a> but I had already ran Bamboo agent as plain application, not service! Again, WTF? Update to IE 11 hasn’t helped. I was going to admit defeat and quarantine failing tests and forget all this challenge. And then I’ve noticed that all failing test cases are using <a href="http://sinonjs.org/" target="_blank" rel="external">sinon.js</a> spies and <a href="http://chaijs.com/" target="_blank" rel="external">chai</a> assertion plugin <a href="http://chaijs.com/plugins/sinon-chai" target="_blank" rel="external">sinon-chai</a> to check callback function calls, so I’ve made a final step in my “Karmic Challenge” - replaced all spies with plain callback: “asyncAction(spy)” -> “asyncAction(function () { done(); })”. It was all over and now I can sleep quietly.</p>
]]></content>
<summary type="html">
<![CDATA[<p>Recently I’ve finished work on small client-side JavaScript library, a simple REST API client, tests for this lib are running with <a hre]]>
</summary>
<category term="bamboo" scheme="http://zuker.github.io/tags/bamboo/"/>
<category term="ci" scheme="http://zuker.github.io/tags/ci/"/>
<category term="karma" scheme="http://zuker.github.io/tags/karma/"/>
<category term="node" scheme="http://zuker.github.io/tags/node/"/>
<category term="ie" scheme="http://zuker.github.io/tags/ie/"/>
<category term="windows" scheme="http://zuker.github.io/tags/windows/"/>
<category term="sinon.js" scheme="http://zuker.github.io/tags/sinon-js/"/>
<category term="chai" scheme="http://zuker.github.io/tags/chai/"/>
<category term="mocha" scheme="http://zuker.github.io/tags/mocha/"/>
<category term="tests" scheme="http://zuker.github.io/tags/tests/"/>
</entry>
</feed>