How to configure travis ci to run Angular 7 build and test

Viewed 62

I am new to travis, I want to have travis build and run angular tests only in master branch, and deploy to heroku only after successful build. I am working with github and i havent been able to run travis at all. i want travis to run if i push to master branch or pull from dev branch to master.

Currently i have this configuration, How can i improve on it, and may something else is needed? I have a karma file you may want to see.

trvis.yml

dist: trusty
sudo: false

language: node_js
node_js:
  - '8'
  -
after_success:
  -test $TRAVIS_BRANCH = "master" &&
    ng build

addons:
  apt:
    sources:
      - google-chrome
    packages:
      - google-chrome-stable

cache:
  directories:
    - ./node_modules

install:
  - npm install

script:
  - npm run test -- --watch=false --no-progress --browsers=ChromeHeadlessNoSandbox
0 Answers
Related