version: 2 # use CircleCI 2.0
jobs:
  build:
    docker:
      - image: circleci/node:10
    steps:
      - checkout # special step to check out source code to working directory

      - restore_cache: # special step to restore the dependency cache
          # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
          keys:
            - v1-repo-{{ checksum "package-lock.json" }}

      - run:
          name: Install dependencies with NPM
          command: yarn install # replace with `yarn install` if using yarn

      - save_cache: # special step to save the dependency cache
          key: v1-repo-{{ checksum "package-lock.json" }}
          paths:
            - "node_modules"

      - run:
          name: Run tests
          command: yarn test:nowatch
      - run:
          name: Linting
          command: yarn lint

workflows:
  version: 2
  Build and Test:
    jobs:
      - build
