I'm using typescript and run mocha acceptance tests. I was confused as to why my tests were failing on the Jenkins albeit they passed locally just fine.

I couldn't find the error. Just after making a pause, implementing something else, I realized what the problem was:

As I renamed a folder from `fixtures` to `tapes` my test run on the Jenkins suddenly claimed to not find the files in `fixtures`. Yet in my code base there was no occurrence of the string `fixtures` anymore and then it hit me like a brick wall:

I have old transpiled files in my outDir, the `dist` folder on the jenkins! Locally, I make sure to run `git clean -fd` once in a while, so I never was hit by it it locally. Yet my jenkins had really old files in the `dist` folder. And just running `rm dist/* && tsc` fixed the entire ordeal.

Well, JavaScript is so 2012 and typescript is the new shit, yet transpiling the code can leave to some quite strong headaches.

  • 1
    Adding a clean task to the start of your build will save you from some of these headaches. When building, especially a RC, its important to ensure you are starting fresh. I think that kinda shit has bite us all at some point though.
  • 0
    @Ronald It's a double edged sword, as builds should also happen blazingly fast only re-building if stuff changed. So in some way I never get around these kinds of cache invalidations.
Add Comment