當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。