function buildE2eBundles()

in dev-utils/test-utils.js [55:106]


function buildE2eBundles(basePath, callback) {
  var cb =
    callback ||
    function (err) {
      if (err) {
        process.exit(2)
      }
    }

  var fileList = walkSync(basePath, /webpack\.config\.js$/)
  fileList = fileList.map(function (file) {
    return path.relative(__dirname, file)
  })
  var configs = fileList
    .map(f => {
      return require(f)
    })
    .reduce((acc, cfg) => {
      if (cfg.length) {
        return acc.concat(cfg)
      } else {
        acc.push(cfg)
        return acc
      }
    }, [])

  console.log('Webpack config files: \n', fileList.join('\n'), '\n')
  webpack(configs, (err, stats) => {
    if (err) {
      console.error(err)
      return cb(err)
    }

    const info = stats.toJson('minimal')
    if (stats.hasErrors()) {
      console.error('There were errors while building')
      info.errors.forEach(err => console.error(err))
      cb(info.errors)
    } else {
      console.log(
        stats.toString({
          colors: true,
          chunks: false,
          assets: false,
          modules: false,
          warnings: false
        })
      )
      cb()
    }
  })
}