jest.config.js (1557B)
1 const path = require( 'path' ) 2 3 module.exports = { 4 rootDir: path.resolve( __dirname ), 5 6 // Override the setup with some of our own stuff. 7 setupFilesAfterEnv: [ 8 '<rootDir>/src/test/setup-test-framework.js', 9 ], 10 11 // Custom mappers. 12 moduleNameMapper: { 13 '^~redux-templates(.*)$': '<rootDir>/src$1', 14 '.*\\.s?css$': '<rootDir>/src/test/scss-stub.js', 15 '.*\\.(png|jpg|gif)$': '<rootDir>/src/test/image-stub.js', 16 '.*\\.svg$': '<rootDir>/src/test/svgr-mock.js', 17 '@wordpress/ajax': '<rootDir>/src/test/ajax-stub.js', 18 '@wordpress/codeEditor': '<rootDir>/src/test/ajax-stub.js', 19 }, 20 21 transform: { 22 '^.+\\.[jt]sx?$': '<rootDir>/node_modules/babel-jest', 23 '\\.mp4$': '<rootDir>/src/test/file-transformer.js', 24 }, 25 26 // Ignore Unexpected identifiers in node_modules/simple-html-tokenizer/dist/es6/tokenizer.js 27 transformIgnorePatterns: [ 28 '<rootDir>/node_modules/(?!simple-html-tokenizer)', 29 ], 30 31 // All relevant code should be included in coverage. 32 collectCoverageFrom: [ 33 'src/(block|components|icons|welcome|help|format-types|higher-order)/**/*.js', 34 '!src/block/ghost-button/**/*', // Deprecated block, don't test anymore. 35 '!src/block/pullquote/**/*', // Deprecated block, don't test anymore. 36 '!**/__test__/**/*', 37 ], 38 39 testMatch: [ '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)' ], 40 41 testPathIgnorePatterns: [ '/node_modules/' ], 42 snapshotSerializers: ['enzyme-to-json/serializer'] 43 }