I have a node-based application in github (https://github.com/telefonicaid/iotagent-ul) connected to travis, so tests are run in each pull request. My application depends on a library (named “iotagent-node-lib” and included as dependency in the packages.json file of my application). Recently iotagent-node-lib changed and since that moment, my application tests started to fail in travis although in my own Linux system the tests keep working…
Just to try, I decided to include a cleanup step in the install stage of my .travis.ymll file (“npm run clean” wich translate to a rm on the packages-lock.json file and node_modules/ directory). And it worked!
It can be seen in this PR: https://github.com/telefonicaid/iotagent-ul/pull/388. In the first commit, before adding “npm run clean” it failed. In the second commit, which just adds “npm run clean” to .travis.yml, it passed.
I’m a bit surprised (I did the modification to .travis.yml in a desperate attemp to solve the problem :). I guess that packages-lock.json or node_modules were there using the old version of iotagent-node-lib and that made the tests to fail. The cleanup forces to reinstall again and it gets solved. However, I though that each time travis runs the test, the enviornment is cleaned so the environment starts “from the scratch”. Why the explicit cleanup is needed in that case? Maybe I’m wrong in my original guessing?
Any feedback or clarification on this is welcome Thanks!