本文整理汇总了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;
},
);
}
示例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');
};
示例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());
}),
示例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');
});
示例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;
}