Now enter the following configuration to it. The most important part are the scripts which should be executed to run your tests:
language: node_jsnode_js:- stableinstall:- npm installscript:- npm test
language: node_jsnode_js:- stableinstall:- npm installscript:- npm run test:unit && npm run test:snapshot && npm run test:cypress
Note: If you are using Cypress.io for E2E testing, you need to add another configuration for addons:
language: node_jsnode_js:- stableaddons:apt:packages:# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves- libgconf-2-4install:- npm installscript:- npm run test:unit && npm run test:snapshot && npm run test:cypress
Last but not least, you can add a fancy badge to your GitHub repository. First, open up your README.md file in your project. If you have no such file, create it on the command line in your project's root folder:
Second, add markdown to describe your project. It's visible in your GitHub repository once you push it. In addition, you can add the fancy badge for your passing or failing build process. At your Travis CI dashboard for your project, you should find the grey and green colored "build passing" badge.
By clicking it, you should get the all the things you need for displaying it in your GitHub repository. You can choose the Markdown version and copy & paste it to your README.md file:
This badge references my project. So make sure to reference your own project by exchanging the account/organization and the repository name. That's it. You have set up continuous integration for your project which informs you when your build fails. Furthermore, it shows a fancy badge in your repository to inform other people that your project builds successfully which adds credibility to your project.