Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/
import type {DefaultOptions} from 'types/Config';
import os from 'os';
import path from 'path';
import {replacePathSepForRegex} from 'jest-regex-util';
import constants from './constants';
const NODE_MODULES_REGEXP = replacePathSepForRegex(constants.NODE_MODULES);
const cacheDirectory = (() => {
const {getuid} = process;
if (getuid == null) {
return path.join(os.tmpdir(), 'jest');
}
// On some platforms tmpdir() is `/tmp`, causing conflicts between different
// users and permission issues. Adding an additional subdivision by UID can
// help.
return path.join(os.tmpdir(), 'jest_' + getuid.call(process).toString(36));
})();
module.exports = ({
automock: false,
bail: false,
browser: false,
/**
* 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 {multipleValidOptions} from 'jest-validate';
import {NODE_MODULES} from './constants';
const NODE_MODULES_REGEXP = replacePathSepForRegex(NODE_MODULES);
const initialOptions: Config.InitialOptions = {
automock: false,
bail: multipleValidOptions(false, 0),
browser: false,
cache: true,
cacheDirectory: '/tmp/user/jest',
changedFilesWithAncestor: false,
changedSince: 'master',
clearMocks: false,
collectCoverage: true,
collectCoverageFrom: ['src', '!public'],
collectCoverageOnlyFrom: {
'/this-directory-is-covered/Covered.js': true,
},
coverageDirectory: 'coverage',
const pathToRegex = p => replacePathSepForRegex(p);
const regexToMatcher = (testRegex: string) => {
options[key]!.map(pattern =>
replacePathSepForRegex(pattern.replace(//g, options.rootDir)),
);
const path = require("path")
const fs = require("fs")
const chalk = require("chalk")
const cosmiconfig = require("cosmiconfig")
const { validate } = require("jest-validate")
const { replacePathSepForRegex } = require("jest-regex-util")
const NODE_MODULES = replacePathSepForRegex(
path.sep + "node_modules" + path.sep
)
export function replaceRootDir(conf, rootDir) {
const replace = s => s.replace("", rootDir)
;["srcPathDirs", "srcPathIgnorePatterns", "localeDir"].forEach(key => {
const value = conf[key]
if (!value) {
} else if (typeof value === "string") {
conf[key] = replace(value)
} else if (value.length) {
conf[key] = value.map(replace)
}
})
/**
* Copyright (c) 2014-present, Facebook, Inc. 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.
*
* @flow
*/
import type {InitialOptions} from 'types/Config';
import {replacePathSepForRegex} from 'jest-regex-util';
import {NODE_MODULES} from './constants';
const NODE_MODULES_REGEXP = replacePathSepForRegex(NODE_MODULES);
export default ({
automock: false,
bail: false,
browser: false,
cache: true,
cacheDirectory: '/tmp/user/jest',
changedFilesWithAncestor: false,
clearMocks: false,
collectCoverage: true,
collectCoverageFrom: ['src', '!public'],
collectCoverageOnlyFrom: {
'/this-directory-is-covered/covered.js': true,
},
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],