version: 2
jobs:
  build:
    working_directory: ~/app
    docker:
      - image: circleci/node:12.6.0
    steps:
      - checkout
      - restore_cache:
          key: dependency-cache-{{ checksum "yarn.lock" }}
      - run:
          name: Install
          command: yarn
      - run:
          name: Lint
          command: yarn lint
      - run:
          name: Test
          command: yarn mocha
      - run:
          name: Coverage
          command: ./node_modules/.bin/nyc report --reporter=html
      - store_artifacts:
          path: coverage
          destination: coverage
      - save_cache:
          key: dependency-cache-{{ checksum "yarn.lock" }}
          paths:
            - ./node_modules
            - ~/.cache/yarn
            - ~/.npm
