Jest Preset Default
Default Jest preset for WordPress development.
Install the module
npm install @wordpress/jest-preset-default --save-dev
jest field in
Brief explanations of options included
scssfiles containing CSS styles will be stubbed out.
modulePaths- the root dir of the project is used as a location to search when resolving modules.
setupFiles- runs code before each test which sets up global variables required in the testing environment.
setupFilesAfterEnv- runs code which adds improved support for
Reactcomponents to the testing framework before each test.
snapshotSerializers- makes it possible to use snapshot tests on
/test/subfolder in addition to the glob patterns Jest uses to detect test files. It detects only test files containing
.ts) suffix. It doesn't match files with
timers- use of fake timers for functions such as
transform- keeps the default babel-jest transformer.
verbose- each individual test won't be reported during the run.