本文整理汇总了TypeScript中jest-regex-util.replacePathSepForRegex函数的典型用法代码示例。如果您正苦于以下问题:TypeScript replacePathSepForRegex函数的具体用法?TypeScript replacePathSepForRegex怎么用?TypeScript replacePathSepForRegex使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replacePathSepForRegex函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: replacePathSepForRegex
options[key]!.map(pattern =>
replacePathSepForRegex(pattern.replace(/<rootDir>/g, options.rootDir)),
示例2: replacePathSepForRegex
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {Config} from '@jest/types';
import {replacePathSepForRegex} from 'jest-regex-util';
import {NODE_MODULES} from './constants';
import getCacheDirectory from './getCacheDirectory';
const NODE_MODULES_REGEXP = replacePathSepForRegex(NODE_MODULES);
const defaultOptions: Config.DefaultOptions = {
automock: false,
bail: 0,
browser: false,
cache: true,
cacheDirectory: getCacheDirectory(),
changedFilesWithAncestor: false,
clearMocks: false,
collectCoverage: false,
collectCoverageFrom: null,
coverageDirectory: null,
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
coverageReporters: ['json', 'text', 'lcov', 'clover'],
coverageThreshold: null,
dependencyExtractor: null,
errorOnDeprecated: false,
expand: false,
示例3: default
export default (
globalConfig: Config.GlobalConfig,
options: AllowedConfigOptions & ExtraConfigOptions = {},
): Config.GlobalConfig => {
const newConfig: Config.GlobalConfig = {...globalConfig};
if (options.mode === 'watch') {
newConfig.watch = true;
newConfig.watchAll = false;
} else if (options.mode === 'watchAll') {
newConfig.watch = false;
newConfig.watchAll = true;
}
if (options.testNamePattern !== undefined) {
newConfig.testNamePattern = options.testNamePattern || '';
}
if (options.testPathPattern !== undefined) {
newConfig.testPathPattern =
replacePathSepForRegex(options.testPathPattern) || '';
}
newConfig.onlyChanged = false;
newConfig.onlyChanged =
!newConfig.watchAll &&
!newConfig.testNamePattern &&
!newConfig.testPathPattern;
if (typeof options.bail === 'boolean') {
newConfig.bail = options.bail ? 1 : 0;
} else if (options.bail !== undefined) {
newConfig.bail = options.bail;
}
if (options.changedSince !== undefined) {
newConfig.changedSince = options.changedSince;
}
if (options.collectCoverage !== undefined) {
newConfig.collectCoverage = options.collectCoverage || false;
}
if (options.collectCoverageFrom !== undefined) {
newConfig.collectCoverageFrom = options.collectCoverageFrom;
}
if (options.collectCoverageOnlyFrom !== undefined) {
newConfig.collectCoverageOnlyFrom = options.collectCoverageOnlyFrom;
}
if (options.coverageDirectory !== undefined) {
newConfig.coverageDirectory = options.coverageDirectory;
}
if (options.coverageReporters !== undefined) {
newConfig.coverageReporters = options.coverageReporters;
}
if (options.noSCM) {
newConfig.noSCM = true;
}
if (options.notify !== undefined) {
newConfig.notify = options.notify || false;
}
if (options.notifyMode !== undefined) {
newConfig.notifyMode = options.notifyMode;
}
if (options.onlyFailures !== undefined) {
newConfig.onlyFailures = options.onlyFailures || false;
}
if (options.passWithNoTests !== undefined) {
newConfig.passWithNoTests = true;
}
if (options.reporters !== undefined) {
newConfig.reporters = options.reporters;
}
if (options.updateSnapshot !== undefined) {
newConfig.updateSnapshot = options.updateSnapshot;
}
if (options.verbose !== undefined) {
newConfig.verbose = options.verbose || false;
}
return Object.freeze(newConfig);
};