Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript unit tests fail during Jenkins build
    text
    copied!<p>I have a couple of projects that use Karma to run Jasmine unit tests. We're using npm for package management and Grunt for building our JavaScript projects and executing their unit test tasks. After committing, these projects are built automatically via Jenkins jobs.</p> <p>On Windows, my projects build successfully. When Jenkins runs the builds on Linux, however, I randomly will see unit test failures that seem to be caused by a previous version of my file being referenced.</p> <p>For example, I have a class that previously called:</p> <pre><code>alert('Cannot retrieve report with the following url: report'); </code></pre> <p>It was recently changed to call:</p> <pre><code>alert('There was an error trying to retrieve report with ID: 123'); </code></pre> <p>When I run my unit tests locally on Windows, every test runs successfully. When Jenkins runs them on Linux, the tests fail with this output:</p> <blockquote> <p>Expected spy alert to have been called with [ 'There was an error trying to retrieve report with ID: 123' ] but actual calls were [ 'Cannot retrieve report with the following url: report' ]</p> </blockquote> <p>It seems that somewhere the old version of my file is being referenced. Is it possible that somewhere something (Jenkins, a Node module, etc.) is caching my files?</p> <p>I've verified that my Jenkins workspace contains the correct versions of the files for which the unit tests are failing. I've also removed any tildes from my package.json and used npm shrinkwrap to ensure that I have full control of my dependencies. I've wiped my workspace several times and created multiple jobs, but I can't seem to rid myself of this problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload