diff --git a/packages/umi-test/src/index.js b/packages/umi-test/src/index.js index dbb6823b9a41..d6b5ad72a86e 100644 --- a/packages/umi-test/src/index.js +++ b/packages/umi-test/src/index.js @@ -38,7 +38,7 @@ export default function(opts = {}) { '\\.tsx?$': require.resolve('./transformers/tsTransformer'), }, testMatch: ['**/?(*.)(spec|test|e2e).(j|t)s?(x)'], - moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'], + moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json'], setupTestFrameworkScriptFile: require.resolve('./jasmine'), moduleNameMapper: { '\\.(css|less|sass|scss)$': require.resolve('identity-obj-proxy'), diff --git a/packages/umi-test/src/transformers/jsTransformer.js b/packages/umi-test/src/transformers/jsTransformer.js index 7bba80fee00f..be2277f0186b 100644 --- a/packages/umi-test/src/transformers/jsTransformer.js +++ b/packages/umi-test/src/transformers/jsTransformer.js @@ -21,6 +21,7 @@ export default babelJest.createTransformer({ enzyme: require.resolve('enzyme'), }, }, + 'module-resolver-in-umi-test', ], ], });