Build a Modern JS Project - #11 Travis CI & Coveralls

Published: 22 February 2019
on channel: Code Realm
11,548
199

In this video, we'll walk through setting up a build pipeline with Travis CI and collecting coverage reports from our unit tests using Coveralls. Be sure to check out the CI/CD basics video first    • Build a Modern JS Project - #2 What i...   to get on board.

Travis CI runs your jobs in phases, including install (to install the dependencies), script (to build the source), and deploy (to optionally deploy to a host), in that order. In a Node.js project, Travis CI by default will execute a clean install (as long as package-lock.json is present) with npm ci https://docs.npmjs.com/cli/ci.html This will read directly from package-lock.json and halt in case of any mismatch with package.json. Then, Travis will run npm test, unless otherwise specified in .travis.yml file.

Once we configure the YML file, we'll move on to Coveralls. Jest already provides a way to generate coverage reports, and we only need to collect and upload them using node-coveralls https://www.npmjs.com/package/coveralls We'll overwrite the default build script to first lint the codebase to make sure we're up to par with the coding style, and then run the test suite and generate the coverage.

As soon as you commit the config file, assuming you've signed up for both Travis and Coveralls, you should see your first build. Once it passes, the coverage should be up on Coveralls. To top it off, we'll add badges for both in our Readme.

Getting started with CI/CD https://docs.travis-ci.com/user/for-b...

Hands-on tutorial with Travis https://github.com/dwyl/learn-travis

Code coverage in 5 minutes https://zach.codes/ci-code-coverage-t...


Watch video Build a Modern JS Project - #11 Travis CI & Coveralls online without registration, duration hours minute second in high quality. This video was added by user Code Realm 22 February 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 11,54 once and liked it 19 people.