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


TypeScript jest-util.createDirectory函数代码示例

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


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

示例1: createContext

 static createContext(
   config: Config.ProjectConfig,
   options: {
     console?: Console;
     maxWorkers: number;
     watch?: boolean;
     watchman: boolean;
   },
 ): Promise<JestContext> {
   createDirectory(config.cacheDirectory);
   const instance = Runtime.createHasteMap(config, {
     console: options.console,
     maxWorkers: options.maxWorkers,
     resetCache: !config.cache,
     watch: options.watch,
     watchman: options.watchman,
   });
   return instance.build().then(
     hasteMap => ({
       config,
       hasteFS: hasteMap.hasteFS,
       moduleMap: hasteMap.moduleMap,
       resolver: Runtime.createResolver(config, hasteMap.moduleMap),
     }),
     error => {
       throw error;
     },
   );
 }
开发者ID:Volune,项目名称:jest,代码行数:29,代码来源:index.ts

示例2: createDirectory

export const linkJestPackage = (packageName: string, cwd: Config.Path) => {
  const packagesDir = path.resolve(__dirname, '../packages');
  const packagePath = path.resolve(packagesDir, packageName);
  const destination = path.resolve(cwd, 'node_modules/', packageName);
  createDirectory(destination);
  rimraf.sync(destination);
  fs.symlinkSync(packagePath, destination, 'dir');
};
开发者ID:Volune,项目名称:jest,代码行数:8,代码来源:Utils.ts

示例3: createDirectory

 configs.map(async (config, index) => {
   createDirectory(config.cacheDirectory);
   const hasteMapInstance = Runtime.createHasteMap(config, {
     console: new CustomConsole(outputStream, outputStream),
     maxWorkers: globalConfig.maxWorkers,
     resetCache: !config.cache,
     watch: globalConfig.watch || globalConfig.watchAll,
     watchman: globalConfig.watchman,
   });
   hasteMapInstances[index] = hasteMapInstance;
   return createContext(config, await hasteMapInstance.build());
 }),
开发者ID:Volune,项目名称:jest,代码行数:12,代码来源:index.ts

示例4: test

test('globalTeardown is triggered once after all test suites', () => {
  createDirectory(DIR);
  const teardownPath = path.resolve(
    __dirname,
    '../global-teardown/teardown.js',
  );
  const result = runWithJson('global-teardown', [
    `--globalTeardown=${teardownPath}`,
    `--testPathPattern=__tests__`,
  ]);

  expect(result.status).toBe(0);
  const files = fs.readdirSync(DIR);
  expect(files).toHaveLength(1);
  const teardown = fs.readFileSync(path.join(DIR, files[0]), 'utf8');
  expect(teardown).toBe('teardown');
});
开发者ID:Volune,项目名称:jest,代码行数:17,代码来源:globalTeardown.test.ts

示例5: _getFileCachePath

  private _getFileCachePath(
    filename: Config.Path,
    content: string,
    instrument: boolean,
  ): Config.Path {
    const baseCacheDir = HasteMap.getCacheFilePath(
      this._config.cacheDirectory,
      'jest-transform-cache-' + this._config.name,
      VERSION,
    );
    const cacheKey = this._getCacheKey(content, filename, instrument);
    // Create sub folders based on the cacheKey to avoid creating one
    // directory with many files.
    const cacheDir = path.join(baseCacheDir, cacheKey[0] + cacheKey[1]);
    const cachePath = slash(
      path.join(
        cacheDir,
        path.basename(filename, path.extname(filename)) + '_' + cacheKey,
      ),
    );
    createDirectory(cacheDir);

    return cachePath;
  }
开发者ID:Volune,项目名称:jest,代码行数:24,代码来源:ScriptTransformer.ts


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