Skip to content

Commit

Permalink
Split CircleCI jobs to isolate visual regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Oct 14, 2020
1 parent 1cddbd0 commit 9397ea2
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 11 deletions.
62 changes: 52 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
version: 2

jobs:
build:
working_directory: ~/identity-style-guide
docker:
- image: circleci/ruby:2.5.3-node-browsers

commands:
bundle-yarn-install:
steps:
- checkout
- restore_cache:
key: dependency-cache-v1-{{ checksum "package-lock.json" }}-{{ checksum "Gemfile.lock" }}
- run:
Expand All @@ -21,15 +16,62 @@ jobs:
paths:
- ~/.npm
- ~/.bundler
- run:
name: Lint JavaScript and Sass
command: npm run lint
build:
steps:
- run:
name: Build assets and site
command: npm run build

jobs:
lints:
working_directory: ~/identity-style-guide
docker:
- image: circleci/ruby:2.5.3-node-browsers
steps:
- checkout
- bundle-yarn-install
- run:
name: Lint JavaScript and Sass
command: npm run lint
integration:
working_directory: ~/identity-style-guide
docker:
- image: circleci/ruby:2.5.3-node-browsers
environment:
SKIP_VISUAL_REGRESSION_TEST: true
steps:
- checkout
- bundle-yarn-install
- build
- run:
name: Run jest integration test
command: npm run test-jest
visual-regression:
working_directory: ~/identity-style-guide
docker:
- image: circleci/ruby:2.5.3-node-browsers
environment:
ONLY_VISUAL_REGRESSION_TEST: true
steps:
- checkout
- bundle-yarn-install
- build
- run:
name: Run visual regression test
command: npm run test-jest
- store_artifacts:
path: tmp/results
destination: results
- store_test_results:
path: tmp/results
accessibility:
working_directory: ~/identity-style-guide
docker:
- image: circleci/ruby:2.5.3-node-browsers
steps:
- checkout
- bundle-yarn-install
- build
- run:
name: Run pa11y accessibility test
command: npm run test-pa11y
Expand Down
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@ module.exports = {
errorOnDeprecated: true,
notify: true,
preset: 'jest-puppeteer',
testMatch: ['**/test/**/*.test.js'],
testMatch: [
'ONLY_VISUAL_REGRESSION_TEST' in process.env
? '**/test/screenshot.test.js'
: '**/test/**/*.test.js',
],
testPathIgnorePatterns: [
'/node_modules/',
'SKIP_VISUAL_REGRESSION_TEST' in process.env && 'screenshot.test.js',
].filter(Boolean),
};

0 comments on commit 9397ea2

Please sign in to comment.