tag:help.appveyor.com,2012-11-13:/discussions/problems/12982-nodejsmocha-builds-randomly-succeedfail-including-when-rebuilding-the-same-commitAppVeyor: Discussion 2018-10-19T08:18:42Ztag:help.appveyor.com,2012-11-13:Comment/449100782018-03-19T17:29:33Z2018-03-19T17:29:33Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>I forked the project and tried a few different appveyor.yml settings. You can check out my builds <a href="https://ci.appveyor.com/project/britzkopf/node-steam-config/history">here</a>.<br>
Here are some of my thoughts,</p>
<ul>
<li>
<p>the section in your test.js file (possibly other places as well) that checks for CI environment variable <code>if (process.env.CI === true)</code> does not seem to be working as intended in windows build environment. I changed to <code>if (process.env.CI === 'True')</code> to get what i interpret as the intended flow.</p>
</li>
<li>
<p>the determination of process architecture section that follows that also doesn't seem to be working properly (though perhaps there is some reason for this approach that is just not clear to me)...</p>
<pre>
<code>if (arch === 'ia32') {
pathTo = path.join('C:', 'Program Files', 'Steam')
} else if (arch === 'ia64') {
pathTo = path.join('C:', 'Program Files (x86)', 'Steam')
}</code>
</pre>
but also, for both jobs in the build the 32 bit version of node is being used.<br>
To remedy this, i changed the environment setting in appveyor.yml to,<br>
<pre>
<code>environment:
matrix:
- nodejs_version: 8</code>
</pre>
instead of,<br>
<pre>
<code>environment:
nodejs_version: 8</code>
</pre>
which is what you had.</li>
<li>
<p>finally, i tried on appveyor's new ubuntu image with the equivalent of your travis settings and, although i got a much higher build success rate there were still stochastic errors.</p>
</li>
</ul>
<p>Do you think its possible that there are some async problems in your testing code that are becoming more error prone in a windows environment?</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/449100782018-03-19T17:31:22Z2018-03-19T17:31:22Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>Also, of note, a very high number of the errors seem to be a web request to a steam server.<br></p>
<pre>
<code> 1) SteamPaths
"before each" hook for "should get the list of owned apps from the cache":
TypeError: Cannot read property 'call' of undefined</code>
</pre>
Perhaps there is a timeout adjustment that can be made?</div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/449100782018-03-20T10:00:57Z2018-03-20T10:00:58Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>I thought I had commented, but apparently I can't even do that right. Yay.</p>
<p>Yeah, I knew about the issue with the errors requesting the owned apps from the server; that one above is a special case though which seems to only happen when something else errors out above and Mocha is apparently internally broken.</p>
<p>I have implemented your fixes and it does seem far more stable -- thank you for your help there -- but of course it's still randomly failing whenever it feels like it.</p>
<p>I also tried using Jest (with the use-jest branch), but that's having random issues too, and not even when using a CI but directly on my machine.</p>
<p>It's obviously an issue deeper in my code, but I'm new to async/await, callbacks, and Promises and have basically no idea what I'm doing when things go bad even after reading more tutorials than I can possibly remember.</p>
<p>I'm sorry to have wasted your time. Thank you.</p></div>l3l_azetag:help.appveyor.com,2012-11-13:Comment/449100782018-03-20T15:16:39Z2018-03-20T15:16:39Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>Not a waste, I'm actually relatively new to the Appveyor support team myself so we're a good match! And i know from experience javascript async/await can be tricky business. I'm sure you have read more articles then you wanted to troubleshooting this but <a href="https://wietse.loves.engineering/testing-promises-with-mocha-90df8b7d2e35">here is one more</a> that might prove relevant.<br>
Also, as you are building for linux I thought i'd let you know, we have recently added Ubuntu build worker images to Appveyor. If your are interested in giving the beta a try let me know and I can add an image to your account.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/449100782018-03-20T23:43:05Z2018-03-20T23:43:06Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>LoL; I just randomly read that article a few minutes ago; it did help me realize part of the issues along with <a href="https://codeburst.io/javascript-async-await-with-foreach-b6ba62bbf404">this one</a> -- I have some async code in map/filter/forEach functions =\</p>
<p>Trying to fix it now, but it's just causing more and more issues, and I'll probably end up having to rebuild everything again from the ground up. Would be nice to refactor some things of course, but this is already at least the sixth iteration and every time I so much as look at this project any more I just want to take it out back and beat it to death without bothering to print it out from the computer first.</p>
<p>Thank you for the offer, but with how terrible everything I touch has been lately I don't want to affect the beta, and I'm nowhere near ready to do beta testing for anything with my terrible-amateur-proof-of-concept-alpha projects.</p>
<p>Thank you for your help; you have been awesome.</p></div>l3l_azetag:help.appveyor.com,2012-11-13:Comment/449100782018-03-22T01:22:41Z2018-03-22T01:22:42Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>Fixed most of it, issues with using async code in non-async functions and the like which were all me from the beginning and not AppVeyor or Mocha, but a dependency of NYC (code coverage tool) updated this morning and broke that completely... So, my lucky streak is still going.</p>
<p>Now aren't you glad I'm not in the beta? Lmao.</p></div>l3l_azetag:help.appveyor.com,2012-11-13:Comment/449100782018-03-22T02:53:22Z2018-03-22T02:53:22Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>Life of a javascript developer :)</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/449100782018-03-22T06:14:30Z2018-03-22T06:34:05Z[NodeJS][mocha] Builds randomly succeed/fail, including when rebuilding the same commit<div><p>Apparently.</p>
<p>Everything is still broken (only on the CI's) after removing nyc now...but different -- now it's throwing an error when trying to use the created dummy path <strong>even though none of that code has changed</strong>. I thought it may be because Node released a new LTS version: 8.10.0 instead of 8.9.4, but even when locking Travis-CI and AppVeyor to 8.9.4 it's still screwed.</p>
<p>If you see someone on the news rioting and rampaging, smashing every damn machine in sight, you know who it is. I'll try to remember to wave, but honestly by that point I will no longer be part of this world.</p>
<p>And if it's not already marked for it please feel free to close this.</p>
<p>Thank you for all you tried to do; see you at my trial.</p>
<p>Last edit: After reverting to a commit made this morning <strong>yet again</strong> (at least the fifth or sixth time) and running that on CI's <strong>again</strong> (at least the millionth time) it's somehow working again. Still planning to be on the news.</p></div>l3l_aze