tools/bazel_rules/jest/jest-resolver.js
/**
 * Try to resolve a folder or filename as js file or as barrel file.
 * @param {string} fileName
 */
Try to resolve a folder or filename as js file or as barrel file.
@param {string} fileName
Try to resolve a folder or filename as js file or as barrel file . @param { string } fileName
function resolveModuleFileName(fileName) {
  const absolutePath = resolve(fileName);
  if (existsSync(`${absolutePath}.js`)) {
    return `${absolutePath}.js`;
  }
  if (existsSync(`${absolutePath}/index.js`)) {
    return `${absolutePath}/index.js`;
  }
  if (existsSync(`${absolutePath}/src/index.js`)) {
    return `${absolutePath}/src/index.js`;
  }
}
function resolveModuleFileName ( fileName ) { const absolutePath = resolve ( fileName ) ; if ( existsSync ( ` ${ absolutePath } ` ) ) { return ` ${ absolutePath } ` ; } if ( existsSync ( ` ${ absolutePath } ` ) ) { return ` ${ absolutePath } ` ; } if ( existsSync ( ` ${ absolutePath } ` ) ) { return ` ${ absolutePath } ` ; } }
Try to resolve a folder or filename as js file or as barrel file.
Try to resolve a folder or filename as js file or as barrel file .
// TODO: lukas.holzer find a more elegant solution for getting the module_root