version: 2
jobs:
  build:
    working_directory: ~/mern-starter
    docker:
      - image: circleci/node:8.10.0
    steps:
      - checkout
      - restore_cache:
          name: Restore Yarn Package Cache
          keys:
            - yarn-packages-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependencies
          command: yarn install
      - save_cache:
          name: Save Yarn Package Cache
          key: yarn-packages-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn
      - run:
          name: Install flow-typed
          command: yarn run flow-typed install
      - run:
          name: Change git config to support UTF8 filename
          command: git config --global core.quotepath false
      - run:
          name: test
          command: yarn test