Karl MUSINGO
Karl MUSINGO

Reputation: 21

All mocha tests pass locally but fail on Travis CI

I am building an api, everything works locally but on Travis-CI, the test fails. For the first time I was getting "mocha: permission denied". I deleted node_modules in my repository so that the Travis can install all dependacies with "npm install". And then I start getting this: enter image description here

Thanks for your help!

Upvotes: 2

Views: 771

Answers (1)

Ivan Vasiljevic
Ivan Vasiljevic

Reputation: 5708

As you can see in picture that you have supplied on remote machine node --version is v0.10.48. In that version Node.js is not supporting ES6 syntax.

In your .travis.yml file you need to set node_js version on which you want to run tests like this:

node_js:
  - 10
  - 9
  - 8

With this part your tests will be run on three version of Node.js. More information what you can put in .travis.yml you can find in official documentation.

Upvotes: 1

Related Questions