happo-plugin-gatsby
A happo.io plugin making it easy to add screenshot testing for Gatsby projects.
Usage
Add the following to your .happo.js
configuration file:
// .happo.jsconst happoPluginGatsby = ; moduleexports = // ... plugins: type: 'plain'
The Gatsby plugin for Happo takes screenshots on pre-built Gatsby pages.
Therefore, before you run happo run
you need to run a Gatsby build. Use the
INSTALL_CMD
environment
variable
to tell Happo to build before screenshooting. This could look something like
this (using Travis CI as an example):
# .travis.yml script:- INSTALL_CMD="yarn build" yarn happo-ci
Options
pageFilter
By default, all Gatsby pages are included in the test suite. By providing a filter function, you can exclude certain pages. Here's an example excluding all "blog" pages:
;
publicFolder
Use this option to override where Happo looks for pre-built Gatsby pages. The
default is path.resolve(process.cwd(), 'public')
. Make sure to use an
absolute file path here.
const path = ; ;