mirror of
git://develop.git.wordpress.org/
synced 2025-02-23 16:15:31 +01:00
Adds the ability to ''locally'' run visual regression testing for wp-admin pages via `npm run test:visual`. Snapshots are stored on contributors' local machines. Note: Wiring to the CI is not included. Why? The challenges for the CI are storage of the artifacts and unreliability of testing these across different environments. This commit is a first step towards visual regression testing. Running it locally provides a learning opportunity which could help to craft how to build it into the automated CI process. Props isabel_brison, andraganescu, azaozz, danfarrow, desrosj, hellofromTonya, justinahinon, netweb, talldanwp. Fixes #49606. git-svn-id: https://develop.svn.wordpress.org/trunk@51989 602fd350-edb4-49c9-b593-d223f7449a82
11 lines
392 B
JavaScript
11 lines
392 B
JavaScript
import { configureToMatchImageSnapshot } from 'jest-image-snapshot';
|
|
|
|
// All available options: https://github.com/americanexpress/jest-image-snapshot#%EF%B8%8F-api
|
|
const toMatchImageSnapshot = configureToMatchImageSnapshot( {
|
|
// Maximum diff to allow in px.
|
|
failureThreshold: 1,
|
|
} );
|
|
|
|
// Extend Jest's "expect" with image snapshot functionality.
|
|
expect.extend( { toMatchImageSnapshot } );
|