packages/zent/scripts/update-jest-module-mapper.js
function createMapper() {
  var packagesDir = path.resolve(__dirname, '../src');
  var packages = fs.readdirSync(packagesDir);

  return packages
    .filter(p => fs.statSync(path.join(packagesDir, p)).isDirectory())
    .reduce((alias, p) => {
      alias[`^${p}$`] = `<rootDir>/src/${p}`;
      alias[`^${p}/(.+)$`] = `<rootDir>/src/${p}/$1`;
      return alias;
    }, {});
}
function createMapper() {
  var packagesDir = path.resolve(__dirname, '../src');
  var packages = fs.readdirSync(packagesDir);

  return packages
    .filter(p => fs.statSync(path.join(packagesDir, p)).isDirectory())
    .reduce((alias, p) => {
      alias[`^${p}$`] = `<rootDir>/src/${p}`;
      alias[`^${p}/(.+)$`] = `<rootDir>/src/${p}/$1`;
      return alias;
    }, {});
}
function createMapper ( ) { var packagesDir = path . resolve ( __dirname , '../src' ) ; var packages = fs . readdirSync ( packagesDir ) ; return packages . filter ( p => fs . statSync ( path . join ( packagesDir , p ) ) . isDirectory ( ) ) . reduce ( ( alias , p ) => { alias [ ` ${ p } ` ] = ` ${ p } ` ; alias [ ` ${ p } ` ] = ` ${ p } ` ; return alias ; } , { } ) ; }
为src目录下的所有子目录创建alias
为src目录下的所有子目录创建alias