How to use the @stryker-mutator/util.fsAsPromised.exists function in @stryker-mutator/util

To help you get started, we’ve selected a few @stryker-mutator/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stryker-mutator / stryker / packages / stryker / src / utils / fileUtils.ts View on Github external
export async function findNodeModules(basePath: string): Promise {
  basePath = path.resolve(basePath);
  const nodeModules = path.resolve(basePath, 'node_modules');
  if (await fsAsPromised.exists(nodeModules)) {
    return nodeModules;
  } else {
    const parent = path.dirname(basePath);
    if (parent === basePath) {
      return null;
    } else {
      return findNodeModules(path.dirname(basePath));
    }
  }
}
github stryker-mutator / stryker / packages / core / src / utils / fileUtils.ts View on Github external
export async function findNodeModules(basePath: string): Promise {
  basePath = path.resolve(basePath);
  const nodeModules = path.resolve(basePath, 'node_modules');
  if (await fsAsPromised.exists(nodeModules)) {
    return nodeModules;
  } else {
    const parent = path.dirname(basePath);
    if (parent === basePath) {
      return null;
    } else {
      return findNodeModules(path.dirname(basePath));
    }
  }
}