Skip to content

Commit

Permalink
Migrate jest new configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Dec 16, 2018
1 parent cf43c19 commit 243a5b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 38 deletions.
29 changes: 6 additions & 23 deletions .jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,10 @@ const transformIgnorePatterns = [

module.exports = {
verbose: true,
setupFiles: [
'./tests/setup.js',
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'md',
],
modulePathIgnorePatterns: [
'/_site/',
],
testPathIgnorePatterns: [
'/node_modules/',
'dekko',
'node',
],
setupFiles: ['./tests/setup.js'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'md'],
modulePathIgnorePatterns: ['/_site/'],
testPathIgnorePatterns: ['/node_modules/', 'dekko', 'node'],
transform: {
'\\.tsx?$': './node_modules/antd-tools/lib/jest/codePreprocessor',
'\\.js$': './node_modules/antd-tools/lib/jest/codePreprocessor',
Expand All @@ -41,12 +26,10 @@ module.exports = {
'!components/**/*/interface.{ts,tsx}',
],
transformIgnorePatterns,
snapshotSerializers: [
'enzyme-to-json/serializer',
],
snapshotSerializers: ['enzyme-to-json/serializer'],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
tsConfig: './tsconfig.test.json',
},
},
testURL: 'http://localhost',
Expand Down
22 changes: 7 additions & 15 deletions .jest.node.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
// jest config for server render environment
const libDir = process.env.LIB_DIR;

module.exports = {
setupFiles: [
'./tests/setup.js',
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'md',
],
setupFiles: ['./tests/setup.js'],
moduleFileExtensions: ['js', 'md', 'ts', 'tsx'],
transform: {
'\\.tsx?$': './node_modules/antd-tools/lib/jest/codePreprocessor',
'\\.js$': './node_modules/antd-tools/lib/jest/codePreprocessor',
'\\.md$': './node_modules/antd-tools/lib/jest/demoPreprocessor',
},
testRegex: 'demo\\.test\\.js$',
testRegex: `${libDir === 'dist' ? 'demo' : '.*'}\\.test\\.js$`,
testEnvironment: 'node',
snapshotSerializers: [
'enzyme-to-json/serializer',
],
snapshotSerializers: ['enzyme-to-json/serializer'],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.test.json',
tsConfig: './tsconfig.test.json',
},
},
};

0 comments on commit 243a5b6

Please sign in to comment.