-
Notifications
You must be signed in to change notification settings - Fork 62
/
jest.config.js
54 lines (45 loc) · 1.63 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const path = require( 'path' )
module.exports = {
rootDir: path.resolve( __dirname ),
// Override the setup with some of our own stuff.
setupFilesAfterEnv: [
'<rootDir>/src/test/setup-test-framework.js',
],
modulePathIgnorePatterns: [
'<rootDir>/freemius',
'<rootDir>/build',
],
// Custom mappers.
moduleNameMapper: {
'^~stackable(.*)$': '<rootDir>/src$1',
'.*\\.s?css$': '<rootDir>/src/test/scss-stub.js',
'.*\\.(png|jpg|gif)$': '<rootDir>/src/test/image-stub.js',
'.*\\.svg$': '<rootDir>/src/test/svgr-mock.js',
stackable: '<rootDir>/src/test/stackable-mock.js',
'@wordpress/ajax': '<rootDir>/src/test/ajax-stub.js',
'@wordpress/codeEditor': '<rootDir>/src/test/ajax-stub.js',
'@wordpress/api': '<rootDir>/src/test/wp-api-stub.js',
'@wordpress/plugins': '<rootDir>/src/test/wp-plugins.js',
},
transform: {
'^.+\\.[jt]sx?$': '<rootDir>/node_modules/babel-jest',
'^.+\\.mp4$': '<rootDir>/src/test/file-transformer.js',
},
// Ignore Unexpected identifiers in node_modules/simple-html-tokenizer/dist/es6/tokenizer.js
transformIgnorePatterns: [
'<rootDir>/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/',
'<rootDir>/pro__premium_only/',
'/src/block',
],
}