const path = require( 'path' ) module.exports = { rootDir: path.resolve( __dirname ), // Override the setup with some of our own stuff. setupFilesAfterEnv: [ '/src/test/setup-test-framework.js', ], // Custom mappers. moduleNameMapper: { '^~redux-templates(.*)$': '/src$1', '.*\\.s?css$': '/src/test/scss-stub.js', '.*\\.(png|jpg|gif)$': '/src/test/image-stub.js', '.*\\.svg$': '/src/test/svgr-mock.js', '@wordpress/ajax': '/src/test/ajax-stub.js', '@wordpress/codeEditor': '/src/test/ajax-stub.js', }, transform: { '^.+\\.[jt]sx?$': '/node_modules/babel-jest', '\\.mp4$': '/src/test/file-transformer.js', }, // Ignore Unexpected identifiers in node_modules/simple-html-tokenizer/dist/es6/tokenizer.js transformIgnorePatterns: [ '/node_modules/(?!simple-html-tokenizer)', ], // All relevant code should be included in coverage. collectCoverageFrom: [ 'src/(block|components|icons|welcome|help|format-types|higher-order)/**/*.js', '!src/block/ghost-button/**/*', // Deprecated block, don't test anymore. '!src/block/pullquote/**/*', // Deprecated block, don't test anymore. '!**/__test__/**/*', ], testMatch: [ '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)' ], testPathIgnorePatterns: [ '/node_modules/' ], snapshotSerializers: ['enzyme-to-json/serializer'] }