version: 2

jobs:
  build:
    working_directory: ~/jest-image-snapshot-example
    docker:
      - image: circleci/node:8.4.0
    environment:
      TZ: "/usr/share/zoneinfo/Asia/Seoul"
    steps:
      - checkout
      - restore_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependency
          command: yarn install
      - save_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
          paths:
            - ./node_modules
            - ~/.yarn-cache
      - run:
          name: Workaround for https://github.com/GoogleChrome/puppeteer/issues/290
          command: sh ./scripts/workaround-puppeteer-issue-290.sh
      - run:
          name: Start Server
          command: yarn start
          background: true
      - run:
          name: Test
          command: |
            sleep 2
            yarn test -- --maxWorkers=2
      - store_artifacts:
          path: test-results
          prefix: tests
      - store_test_results:
          path: test-results

version: 2

jobs:
  build:
    working_directory: ~/jest-image-snapshot-example
    docker:
      - image: circleci/node:8.4.0
    environment:
      TZ: "/usr/share/zoneinfo/Asia/Seoul"
    steps:
      - checkout
      - restore_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
      - run:
          name: Install Dependency
          command: yarn install
      - save_cache:
          key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
          paths:
            - ./node_modules
            - ~/.yarn-cache
      - run:
          name: Workaround for https://github.com/GoogleChrome/puppeteer/issues/290
          command: sh ./scripts/workaround-puppeteer-issue-290.sh
      - run:
          name: Start Server
          command: yarn start
          background: true
      - run:
          name: Test
          command: |
            sleep 2
            yarn test -- --maxWorkers=2
      - store_artifacts:
          path: test/__image_snapshots__/__diff_output__
          destination: image_snapshot_diff

Update Circle CI store_artifacts step to save image snapshot diffs
Update Circle CI store_artifacts step to save image snapshot diffs
