当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript micromatch.some函数代码示例

本文整理汇总了TypeScript中micromatch.some函数的典型用法代码示例。如果您正苦于以下问题:TypeScript some函数的具体用法?TypeScript some怎么用?TypeScript some使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了some函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: isFileIncluded

 private isFileIncluded(relativePath: string) {
   if (this.doIgnore(relativePath)) {
     return false;
   }
   return this.glob.length
     ? micromatch.some(relativePath, this.glob, {dot: this.dot})
     : this.dot || micromatch.some(relativePath, '**/*');
 }
开发者ID:facebook,项目名称:jest,代码行数:8,代码来源:FSEventsWatcher.ts

示例2: replacePathSepForGlob

 collectCoverageFrom = collectCoverageFrom.reduce((patterns, filename) => {
   if (
     !micromatch.some(
       replacePathSepForGlob(path.relative(options.rootDir, filename)),
       newOptions.collectCoverageFrom!,
     )
   ) {
     return patterns;
   }
   return [...patterns, filename];
 }, newOptions.collectCoverageFrom);
开发者ID:Volune,项目名称:jest,代码行数:11,代码来源:normalize.ts

示例3: matchFilesWithGlob

 matchFilesWithGlob(
   globs: Array<Config.Glob>,
   root: Config.Path | null,
 ): Set<Config.Path> {
   const files = new Set();
   for (const file of this.getAbsoluteFileIterator()) {
     const filePath = root ? fastPath.relative(root, file) : file;
     if (micromatch.some(replacePathSepForGlob(filePath), globs)) {
       files.add(file);
     }
   }
   return files;
 }
开发者ID:Volune,项目名称:jest,代码行数:13,代码来源:HasteFS.ts

示例4: slash

const formatPaths = (
  config: StackTraceConfig,
  relativeTestPath: Path | null,
  line: string,
) => {
  // Extract the file path from the trace line.
  const match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
  if (!match) {
    return line;
  }

  let filePath = slash(path.relative(config.rootDir, match[2]));
  // highlight paths from the current test file
  if (
    (config.testMatch &&
      config.testMatch.length &&
      micromatch.some(filePath, config.testMatch)) ||
    filePath === relativeTestPath
  ) {
    filePath = chalk.reset.cyan(filePath);
  }
  return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
};
开发者ID:elliottsj,项目名称:jest,代码行数:23,代码来源:index.ts

示例5: return

 return (path: Config.Path) =>
   micromatch.some(replacePathSepForGlob(path), globs, {dot: true});
开发者ID:Volune,项目名称:jest,代码行数:2,代码来源:SearchSource.ts

示例6: shouldInstrument

export default function shouldInstrument(
  filename: Config.Path,
  options: ShouldInstrumentOptions,
  config: Config.ProjectConfig,
): boolean {
  if (!options.collectCoverage) {
    return false;
  }

  if (
    config.forceCoverageMatch.length &&
    micromatch.any(filename, config.forceCoverageMatch)
  ) {
    return true;
  }

  if (
    !config.testPathIgnorePatterns.some(pattern => !!filename.match(pattern))
  ) {
    if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {
      return false;
    }

    if (micromatch.some(replacePathSepForGlob(filename), config.testMatch)) {
      return false;
    }
  }

  if (
    // This configuration field contains an object in the form of:
    // {'path/to/file.js': true}
    options.collectCoverageOnlyFrom &&
    !options.collectCoverageOnlyFrom[filename]
  ) {
    return false;
  }

  if (
    // still cover if `only` is specified
    !options.collectCoverageOnlyFrom &&
    options.collectCoverageFrom &&
    !micromatch.some(
      replacePathSepForGlob(path.relative(config.rootDir, filename)),
      options.collectCoverageFrom,
    )
  ) {
    return false;
  }

  if (
    config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern))
  ) {
    return false;
  }

  if (config.globalSetup === filename) {
    return false;
  }

  if (config.globalTeardown === filename) {
    return false;
  }

  if (config.setupFiles.some(setupFile => setupFile === filename)) {
    return false;
  }

  if (config.setupFilesAfterEnv.some(setupFile => setupFile === filename)) {
    return false;
  }

  if (MOCKS_PATTERN.test(filename)) {
    return false;
  }

  if (options.changedFiles && !options.changedFiles.has(filename)) {
    return false;
  }

  return true;
}
开发者ID:Volune,项目名称:jest,代码行数:81,代码来源:shouldInstrument.ts


注:本文中的micromatch.some函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。