initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

28
node_modules/jest-config/build/constants.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.JEST_CONFIG = exports.PACKAGE_JSON = exports.DEFAULT_REPORTER_LABEL = exports.DEFAULT_JS_PATTERN = exports.NODE_MODULES = undefined;
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const NODE_MODULES = exports.NODE_MODULES = (_path || _load_path()).default.sep + 'node_modules' + (_path || _load_path()).default.sep; /**
* 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.
*
*
*/
const DEFAULT_JS_PATTERN = exports.DEFAULT_JS_PATTERN = '^.+\\.jsx?$';
const DEFAULT_REPORTER_LABEL = exports.DEFAULT_REPORTER_LABEL = 'default';
const PACKAGE_JSON = exports.PACKAGE_JSON = 'package.json';
const JEST_CONFIG = exports.JEST_CONFIG = 'jest.config.js';

104
node_modules/jest-config/build/defaults.js generated vendored Normal file
View File

@@ -0,0 +1,104 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _os;
function _load_os() {
return _os = _interopRequireDefault(require('os'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _jestRegexUtil;
function _load_jestRegexUtil() {
return _jestRegexUtil = require('jest-regex-util');
}
var _constants;
function _load_constants() {
return _constants = require('./constants');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const NODE_MODULES_REGEXP = (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)((_constants || _load_constants()).NODE_MODULES); /**
* 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.
*
*
*/
const cacheDirectory = (() => {
var _process = process;
const getuid = _process.getuid;
if (getuid == null) {
return (_path || _load_path()).default.join((_os || _load_os()).default.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 || _load_path()).default.join((_os || _load_os()).default.tmpdir(), 'jest_' + getuid.call(process).toString(36));
})();
exports.default = {
automock: false,
bail: false,
browser: false,
cache: true,
cacheDirectory,
changedFilesWithAncestor: false,
clearMocks: false,
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
coverageReporters: ['json', 'text', 'lcov', 'clover'],
detectLeaks: false,
expand: false,
forceCoverageMatch: [],
globalSetup: null,
globalTeardown: null,
globals: {},
haste: {
providesModuleNodeModules: []
},
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
moduleNameMapper: {},
modulePathIgnorePatterns: [],
noStackTrace: false,
notify: false,
notifyMode: 'always',
preset: null,
resetMocks: false,
resetModules: false,
restoreMocks: false,
runTestsByPath: false,
runner: 'jest-runner',
snapshotSerializers: [],
testEnvironment: 'jest-environment-jsdom',
testEnvironmentOptions: {},
testFailureExitCode: 1,
testLocationInResults: false,
testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)'],
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
testRegex: '',
testResultsProcessor: null,
testURL: 'about:blank',
timers: 'real',
transformIgnorePatterns: [NODE_MODULES_REGEXP],
useStderr: false,
verbose: null,
watch: false,
watchPathIgnorePatterns: [],
watchman: true
};

64
node_modules/jest-config/build/deprecated.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _prettyFormat;
function _load_prettyFormat() {
return _prettyFormat = _interopRequireDefault(require('pretty-format'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* 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.
*
*
*/
const format = value => (0, (_prettyFormat || _load_prettyFormat()).default)(value, { min: true });
exports.default = {
mapCoverage: () => ` Option ${(_chalk || _load_chalk()).default.bold('"mapCoverage"')} has been removed, as it's no longer necessary.
Please update your configuration.`,
preprocessorIgnorePatterns: options => ` Option ${(_chalk || _load_chalk()).default.bold('"preprocessorIgnorePatterns"')} was replaced by ${(_chalk || _load_chalk()).default.bold('"transformIgnorePatterns"')}, which support multiple preprocessors.
Jest now treats your current configuration as:
{
${(_chalk || _load_chalk()).default.bold('"transformIgnorePatterns"')}: ${(_chalk || _load_chalk()).default.bold(format(options.preprocessorIgnorePatterns))}
}
Please update your configuration.`,
scriptPreprocessor: options => ` Option ${(_chalk || _load_chalk()).default.bold('"scriptPreprocessor"')} was replaced by ${(_chalk || _load_chalk()).default.bold('"transform"')}, which support multiple preprocessors.
Jest now treats your current configuration as:
{
${(_chalk || _load_chalk()).default.bold('"transform"')}: ${(_chalk || _load_chalk()).default.bold(`{".*": ${format(options.scriptPreprocessor)}}`)}
}
Please update your configuration.`,
testPathDirs: options => ` Option ${(_chalk || _load_chalk()).default.bold('"testPathDirs"')} was replaced by ${(_chalk || _load_chalk()).default.bold('"roots"')}.
Jest now treats your current configuration as:
{
${(_chalk || _load_chalk()).default.bold('"roots"')}: ${(_chalk || _load_chalk()).default.bold(format(options.testPathDirs))}
}
Please update your configuration.
`
};

34
node_modules/jest-config/build/get_max_workers.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getMaxWorkers;
var _os;
function _load_os() {
return _os = _interopRequireDefault(require('os'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* 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.
*
*
*/
function getMaxWorkers(argv) {
if (argv.runInBand) {
return 1;
} else if (argv.maxWorkers) {
return parseInt(argv.maxWorkers, 10);
} else {
const cpus = (_os || _load_os()).default.cpus().length;
return Math.max(argv.watch ? Math.floor(cpus / 2) : cpus - 1, 1);
}
}

234
node_modules/jest-config/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,234 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.deprecationEntries = exports.normalize = exports.isJSONString = exports.getTestEnvironment = undefined;
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
Object.defineProperty(exports, 'getTestEnvironment', {
enumerable: true,
get: function () {
return (_utils || _load_utils()).getTestEnvironment;
}
});
Object.defineProperty(exports, 'isJSONString', {
enumerable: true,
get: function () {
return (_utils || _load_utils()).isJSONString;
}
});
var _normalize2;
function _load_normalize() {
return _normalize2 = require('./normalize');
}
Object.defineProperty(exports, 'normalize', {
enumerable: true,
get: function () {
return _interopRequireDefault(_normalize2 || _load_normalize()).default;
}
});
var _deprecated;
function _load_deprecated() {
return _deprecated = require('./deprecated');
}
Object.defineProperty(exports, 'deprecationEntries', {
enumerable: true,
get: function () {
return _interopRequireDefault(_deprecated || _load_deprecated()).default;
}
});
exports.readConfig = readConfig;
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _normalize3;
function _load_normalize2() {
return _normalize3 = _interopRequireDefault(require('./normalize'));
}
var _resolve_config_path;
function _load_resolve_config_path() {
return _resolve_config_path = _interopRequireDefault(require('./resolve_config_path'));
}
var _read_config_file_and_set_root_dir;
function _load_read_config_file_and_set_root_dir() {
return _read_config_file_and_set_root_dir = _interopRequireDefault(require('./read_config_file_and_set_root_dir'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function readConfig(argv, packageRootOrConfig,
// Whether it needs to look into `--config` arg passed to CLI.
// It only used to read initial config. If the initial config contains
// `project` property, we don't want to read `--config` value and rather
skipArgvConfigOption, parentConfigPath) {
let rawOptions;
let configPath = null;
if (typeof packageRootOrConfig !== 'string') {
if (parentConfigPath) {
rawOptions = packageRootOrConfig;
rawOptions.rootDir = (_path || _load_path()).default.dirname(parentConfigPath);
} else {
throw new Error('Jest: Cannot use configuration as an object without a file path.');
}
} else if ((0, (_utils || _load_utils()).isJSONString)(argv.config)) {
// A JSON string was passed to `--config` argument and we can parse it
// and use as is.
let config;
try {
config = JSON.parse(argv.config);
} catch (e) {
throw new Error('There was an error while parsing the `--config` argument as a JSON string.');
}
// NOTE: we might need to resolve this dir to an absolute path in the future
config.rootDir = config.rootDir || packageRootOrConfig;
rawOptions = config;
// A string passed to `--config`, which is either a direct path to the config
// or a path to directory containing `package.json` or `jest.conf.js`
} else if (!skipArgvConfigOption && typeof argv.config == 'string') {
configPath = (0, (_resolve_config_path || _load_resolve_config_path()).default)(argv.config, process.cwd());
rawOptions = (0, (_read_config_file_and_set_root_dir || _load_read_config_file_and_set_root_dir()).default)(configPath);
} else {
// Otherwise just try to find config in the current rootDir.
configPath = (0, (_resolve_config_path || _load_resolve_config_path()).default)(packageRootOrConfig, process.cwd());
rawOptions = (0, (_read_config_file_and_set_root_dir || _load_read_config_file_and_set_root_dir()).default)(configPath);
}
var _normalize = (0, (_normalize3 || _load_normalize2()).default)(rawOptions, argv);
const options = _normalize.options,
hasDeprecationWarnings = _normalize.hasDeprecationWarnings;
var _getConfigs = getConfigs(options);
const globalConfig = _getConfigs.globalConfig,
projectConfig = _getConfigs.projectConfig;
return {
configPath,
globalConfig,
hasDeprecationWarnings,
projectConfig
};
}
const getConfigs = options => {
return {
globalConfig: Object.freeze({
bail: options.bail,
changedFilesWithAncestor: options.changedFilesWithAncestor,
changedSince: options.changedSince,
collectCoverage: options.collectCoverage,
collectCoverageFrom: options.collectCoverageFrom,
collectCoverageOnlyFrom: options.collectCoverageOnlyFrom,
coverageDirectory: options.coverageDirectory,
coverageReporters: options.coverageReporters,
coverageThreshold: options.coverageThreshold,
detectLeaks: options.detectLeaks,
enabledTestsMap: options.enabledTestsMap,
expand: options.expand,
findRelatedTests: options.findRelatedTests,
forceExit: options.forceExit,
globalSetup: options.globalSetup,
globalTeardown: options.globalTeardown,
json: options.json,
lastCommit: options.lastCommit,
listTests: options.listTests,
logHeapUsage: options.logHeapUsage,
maxWorkers: options.maxWorkers,
noSCM: undefined,
noStackTrace: options.noStackTrace,
nonFlagArgs: options.nonFlagArgs,
notify: options.notify,
notifyMode: options.notifyMode,
onlyChanged: options.onlyChanged,
onlyFailures: options.onlyFailures,
outputFile: options.outputFile,
passWithNoTests: options.passWithNoTests,
projects: options.projects,
replname: options.replname,
reporters: options.reporters,
rootDir: options.rootDir,
runTestsByPath: options.runTestsByPath,
silent: options.silent,
testFailureExitCode: options.testFailureExitCode,
testNamePattern: options.testNamePattern,
testPathPattern: options.testPathPattern,
testResultsProcessor: options.testResultsProcessor,
updateSnapshot: options.updateSnapshot,
useStderr: options.useStderr,
verbose: options.verbose,
watch: options.watch,
watchAll: options.watchAll,
watchPlugins: options.watchPlugins,
watchman: options.watchman
}),
projectConfig: Object.freeze({
automock: options.automock,
browser: options.browser,
cache: options.cache,
cacheDirectory: options.cacheDirectory,
clearMocks: options.clearMocks,
coveragePathIgnorePatterns: options.coveragePathIgnorePatterns,
cwd: options.cwd,
detectLeaks: options.detectLeaks,
displayName: options.displayName,
forceCoverageMatch: options.forceCoverageMatch,
globals: options.globals,
haste: options.haste,
moduleDirectories: options.moduleDirectories,
moduleFileExtensions: options.moduleFileExtensions,
moduleLoader: options.moduleLoader,
moduleNameMapper: options.moduleNameMapper,
modulePathIgnorePatterns: options.modulePathIgnorePatterns,
modulePaths: options.modulePaths,
name: options.name,
resetMocks: options.resetMocks,
resetModules: options.resetModules,
resolver: options.resolver,
restoreMocks: options.restoreMocks,
rootDir: options.rootDir,
roots: options.roots,
runner: options.runner,
setupFiles: options.setupFiles,
setupTestFrameworkScriptFile: options.setupTestFrameworkScriptFile,
skipNodeResolution: options.skipNodeResolution,
snapshotSerializers: options.snapshotSerializers,
testEnvironment: options.testEnvironment,
testEnvironmentOptions: options.testEnvironmentOptions,
testLocationInResults: options.testLocationInResults,
testMatch: options.testMatch,
testPathIgnorePatterns: options.testPathIgnorePatterns,
testRegex: options.testRegex,
testRunner: options.testRunner,
testURL: options.testURL,
timers: options.timers,
transform: options.transform,
transformIgnorePatterns: options.transformIgnorePatterns,
unmockedModulePathPatterns: options.unmockedModulePathPatterns,
watchPathIgnorePatterns: options.watchPathIgnorePatterns
})
};
};

567
node_modules/jest-config/build/normalize.js generated vendored Normal file
View File

@@ -0,0 +1,567 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = normalize;
var _crypto;
function _load_crypto() {
return _crypto = _interopRequireDefault(require('crypto'));
}
var _glob;
function _load_glob() {
return _glob = _interopRequireDefault(require('glob'));
}
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _jestValidate;
function _load_jestValidate() {
return _jestValidate = require('jest-validate');
}
var _validate_pattern;
function _load_validate_pattern() {
return _validate_pattern = _interopRequireDefault(require('./validate_pattern'));
}
var _jestUtil;
function _load_jestUtil() {
return _jestUtil = require('jest-util');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _get_max_workers;
function _load_get_max_workers() {
return _get_max_workers = _interopRequireDefault(require('./get_max_workers'));
}
var _jestResolve;
function _load_jestResolve() {
return _jestResolve = _interopRequireDefault(require('jest-resolve'));
}
var _jestRegexUtil;
function _load_jestRegexUtil() {
return _jestRegexUtil = require('jest-regex-util');
}
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
var _constants;
function _load_constants() {
return _constants = require('./constants');
}
var _reporter_validation_errors;
function _load_reporter_validation_errors() {
return _reporter_validation_errors = require('./reporter_validation_errors');
}
var _defaults;
function _load_defaults() {
return _defaults = _interopRequireDefault(require('./defaults'));
}
var _deprecated;
function _load_deprecated() {
return _deprecated = _interopRequireDefault(require('./deprecated'));
}
var _set_from_argv;
function _load_set_from_argv() {
return _set_from_argv = _interopRequireDefault(require('./set_from_argv'));
}
var _valid_config;
function _load_valid_config() {
return _valid_config = _interopRequireDefault(require('./valid_config'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } /**
* 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.
*
*
*/
const ERROR = `${(_utils || _load_utils()).BULLET}Validation Error`;
const JSON_EXTENSION = '.json';
const PRESET_NAME = 'jest-preset' + JSON_EXTENSION;
const createConfigError = message => new (_jestValidate || _load_jestValidate()).ValidationError(ERROR, message, (_utils || _load_utils()).DOCUMENTATION_NOTE);
const mergeOptionWithPreset = (options, preset, optionName) => {
if (options[optionName] && preset[optionName]) {
options[optionName] = Object.assign({}, options[optionName], preset[optionName], options[optionName]);
}
};
const setupPreset = (options, optionsPreset) => {
let preset;
const presetPath = (0, (_utils || _load_utils())._replaceRootDirInPath)(options.rootDir, optionsPreset);
const presetModule = (_jestResolve || _load_jestResolve()).default.findNodeModule(presetPath.endsWith(JSON_EXTENSION) ? presetPath : (_path || _load_path()).default.join(presetPath, PRESET_NAME), {
basedir: options.rootDir
});
try {
// $FlowFixMe
preset = require(presetModule);
} catch (error) {
if (error instanceof SyntaxError) {
throw createConfigError(` Preset ${(_chalk || _load_chalk()).default.bold(presetPath)} is invalid:\n ${error.message}`);
}
throw createConfigError(` Preset ${(_chalk || _load_chalk()).default.bold(presetPath)} not found.`);
}
if (options.setupFiles) {
options.setupFiles = (preset.setupFiles || []).concat(options.setupFiles);
}
if (options.modulePathIgnorePatterns && preset.modulePathIgnorePatterns) {
options.modulePathIgnorePatterns = preset.modulePathIgnorePatterns.concat(options.modulePathIgnorePatterns);
}
mergeOptionWithPreset(options, preset, 'moduleNameMapper');
mergeOptionWithPreset(options, preset, 'transform');
return Object.assign({}, preset, options);
};
const setupBabelJest = options => {
const basedir = options.rootDir;
const transform = options.transform;
let babelJest;
if (transform) {
const customJSPattern = Object.keys(transform).find(pattern => {
const regex = new RegExp(pattern);
return regex.test('a.js') || regex.test('a.jsx');
});
if (customJSPattern) {
const jsTransformer = (_jestResolve || _load_jestResolve()).default.findNodeModule(transform[customJSPattern], { basedir });
if (jsTransformer && jsTransformer.includes((_constants || _load_constants()).NODE_MODULES + 'babel-jest')) {
babelJest = jsTransformer;
}
}
} else {
babelJest = (_jestResolve || _load_jestResolve()).default.findNodeModule('babel-jest', { basedir });
if (babelJest) {
options.transform = {
[(_constants || _load_constants()).DEFAULT_JS_PATTERN]: 'babel-jest'
};
}
}
return babelJest;
};
const normalizeCollectCoverageOnlyFrom = (options, key) => {
const collectCoverageOnlyFrom = Array.isArray(options[key]) ? options[key] // passed from argv
: Object.keys(options[key]); // passed from options
return collectCoverageOnlyFrom.reduce((map, filePath) => {
filePath = (_path || _load_path()).default.resolve(options.rootDir, (0, (_utils || _load_utils())._replaceRootDirInPath)(options.rootDir, filePath));
map[filePath] = true;
return map;
}, Object.create(null));
};
const normalizeCollectCoverageFrom = (options, key) => {
let value;
if (!options[key]) {
value = [];
}
if (!Array.isArray(options[key])) {
try {
value = JSON.parse(options[key]);
} catch (e) {}
Array.isArray(value) || (value = [options[key]]);
} else {
value = options[key];
}
if (value) {
value = value.map(filePath => {
return filePath.replace(/^(!?)(<rootDir>\/)(.*)/, '$1$3');
});
}
return value;
};
const normalizeUnmockedModulePathPatterns = (options, key) => {
// _replaceRootDirTags is specifically well-suited for substituting
// <rootDir> in paths (it deals with properly interpreting relative path
// separators, etc).
//
// For patterns, direct global substitution is far more ideal, so we
// special case substitutions for patterns here.
return options[key].map(pattern => (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)(pattern.replace(/<rootDir>/g, options.rootDir)));
};
const normalizePreprocessor = options => {
if (options.scriptPreprocessor && options.transform) {
throw createConfigError(` Options: ${(_chalk || _load_chalk()).default.bold('scriptPreprocessor')} and ${(_chalk || _load_chalk()).default.bold('transform')} cannot be used together.
Please change your configuration to only use ${(_chalk || _load_chalk()).default.bold('transform')}.`);
}
if (options.preprocessorIgnorePatterns && options.transformIgnorePatterns) {
throw createConfigError(` Options ${(_chalk || _load_chalk()).default.bold('preprocessorIgnorePatterns')} and ${(_chalk || _load_chalk()).default.bold('transformIgnorePatterns')} cannot be used together.
Please change your configuration to only use ${(_chalk || _load_chalk()).default.bold('transformIgnorePatterns')}.`);
}
if (options.scriptPreprocessor) {
options.transform = {
'.*': options.scriptPreprocessor
};
}
if (options.preprocessorIgnorePatterns) {
options.transformIgnorePatterns = options.preprocessorIgnorePatterns;
}
delete options.scriptPreprocessor;
delete options.preprocessorIgnorePatterns;
return options;
};
const normalizeMissingOptions = options => {
if (!options.name) {
options.name = (_crypto || _load_crypto()).default.createHash('md5').update(options.rootDir).digest('hex');
}
if (!options.setupFiles) {
options.setupFiles = [];
}
return options;
};
const normalizeRootDir = options => {
// Assert that there *is* a rootDir
if (!options.hasOwnProperty('rootDir')) {
throw createConfigError(` Configuration option ${(_chalk || _load_chalk()).default.bold('rootDir')} must be specified.`);
}
options.rootDir = (_path || _load_path()).default.normalize(options.rootDir);
return options;
};
const normalizeReporters = (options, basedir) => {
const reporters = options.reporters;
if (!reporters || !Array.isArray(reporters)) {
return options;
}
(0, (_reporter_validation_errors || _load_reporter_validation_errors()).validateReporters)(reporters);
options.reporters = reporters.map(reporterConfig => {
const normalizedReporterConfig = typeof reporterConfig === 'string' ? // if reporter config is a string, we wrap it in an array
// and pass an empty object for options argument, to normalize
// the shape.
[reporterConfig, {}] : reporterConfig;
const reporterPath = (0, (_utils || _load_utils())._replaceRootDirInPath)(options.rootDir, normalizedReporterConfig[0]);
if (reporterPath !== (_constants || _load_constants()).DEFAULT_REPORTER_LABEL) {
const reporter = (_jestResolve || _load_jestResolve()).default.findNodeModule(reporterPath, {
basedir: options.rootDir
});
if (!reporter) {
throw new Error(`Could not resolve a module for a custom reporter.\n` + ` Module name: ${reporterPath}`);
}
normalizedReporterConfig[0] = reporter;
}
return normalizedReporterConfig;
});
return options;
};
const buildTestPathPattern = argv => {
const patterns = [];
if (argv._) {
patterns.push.apply(patterns, _toConsumableArray(argv._));
}
if (argv.testPathPattern) {
patterns.push.apply(patterns, _toConsumableArray(argv.testPathPattern));
}
const replacePosixSep = pattern => {
if ((_path || _load_path()).default.sep === '/') {
return pattern;
}
return pattern.replace(/\//g, '\\\\');
};
const testPathPattern = patterns.map(replacePosixSep).join('|');
if ((0, (_validate_pattern || _load_validate_pattern()).default)(testPathPattern)) {
return testPathPattern;
} else {
showTestPathPatternError(testPathPattern);
return '';
}
};
const showTestPathPatternError = testPathPattern => {
(0, (_jestUtil || _load_jestUtil()).clearLine)(process.stdout);
console.log((_chalk || _load_chalk()).default.red(` Invalid testPattern ${testPathPattern} supplied. ` + `Running all tests instead.`));
};
function normalize(options, argv) {
var _validate = (0, (_jestValidate || _load_jestValidate()).validate)(options, {
comment: (_utils || _load_utils()).DOCUMENTATION_NOTE,
deprecatedConfig: (_deprecated || _load_deprecated()).default,
exampleConfig: (_valid_config || _load_valid_config()).default
});
const hasDeprecationWarnings = _validate.hasDeprecationWarnings;
options = normalizePreprocessor(normalizeReporters(normalizeMissingOptions(normalizeRootDir((0, (_set_from_argv || _load_set_from_argv()).default)(options, argv)))));
if (options.preset) {
options = setupPreset(options, options.preset);
}
if (options.testEnvironment) {
options.testEnvironment = (0, (_utils || _load_utils()).getTestEnvironment)(options);
}
if (!options.roots && options.testPathDirs) {
options.roots = options.testPathDirs;
delete options.testPathDirs;
}
if (!options.roots) {
options.roots = [options.rootDir];
}
if (!options.testRunner || options.testRunner === 'jasmine2') {
options.testRunner = require.resolve('jest-jasmine2');
}
if (!options.coverageDirectory) {
options.coverageDirectory = (_path || _load_path()).default.resolve(options.rootDir, 'coverage');
}
const babelJest = setupBabelJest(options);
const newOptions = Object.assign({}, (_defaults || _load_defaults()).default);
// Cast back to exact type
options = options;
Object.keys(options).reduce((newOptions, key) => {
let value;
switch (key) {
case 'collectCoverageOnlyFrom':
value = normalizeCollectCoverageOnlyFrom(options, key);
break;
case 'setupFiles':
case 'snapshotSerializers':
value = options[key] && options[key].map((_utils || _load_utils()).resolve.bind(null, options.rootDir, key));
break;
case 'modulePaths':
case 'roots':
value = options[key] && options[key].map(filePath => (_path || _load_path()).default.resolve(options.rootDir, (0, (_utils || _load_utils())._replaceRootDirInPath)(options.rootDir, filePath)));
break;
case 'collectCoverageFrom':
value = normalizeCollectCoverageFrom(options, key);
break;
case 'cacheDirectory':
case 'coverageDirectory':
value = options[key] && (_path || _load_path()).default.resolve(options.rootDir, (0, (_utils || _load_utils())._replaceRootDirInPath)(options.rootDir, options[key]));
break;
case 'globalSetup':
case 'globalTeardown':
case 'moduleLoader':
case 'resolver':
case 'runner':
case 'setupTestFrameworkScriptFile':
case 'testResultsProcessor':
case 'testRunner':
value = options[key] && (0, (_utils || _load_utils()).resolve)(options.rootDir, key, options[key]);
break;
case 'moduleNameMapper':
const moduleNameMapper = options[key];
value = moduleNameMapper && Object.keys(moduleNameMapper).map(regex => {
const item = moduleNameMapper && moduleNameMapper[regex];
return item && [regex, (0, (_utils || _load_utils())._replaceRootDirTags)(options.rootDir, item)];
});
break;
case 'transform':
const transform = options[key];
value = transform && Object.keys(transform).map(regex => [regex, (0, (_utils || _load_utils()).resolve)(options.rootDir, key, transform[regex])]);
break;
case 'coveragePathIgnorePatterns':
case 'modulePathIgnorePatterns':
case 'testPathIgnorePatterns':
case 'transformIgnorePatterns':
case 'watchPathIgnorePatterns':
case 'unmockedModulePathPatterns':
value = normalizeUnmockedModulePathPatterns(options, key);
break;
case 'haste':
value = Object.assign({}, options[key]);
if (value.hasteImplModulePath != null) {
value.hasteImplModulePath = (0, (_utils || _load_utils()).resolve)(options.rootDir, 'haste.hasteImplModulePath', (0, (_utils || _load_utils())._replaceRootDirInPath)(options.rootDir, value.hasteImplModulePath));
}
break;
case 'projects':
value = (options[key] || []).map(project => (0, (_utils || _load_utils())._replaceRootDirTags)(options.rootDir, project)).reduce((projects, project) => {
// Project can be specified as globs. If a glob matches any files,
// We expand it to these paths. If not, we keep the original path
// for the future resolution.
const globMatches = typeof project === 'string' ? (_glob || _load_glob()).default.sync(project) : [];
return projects.concat(globMatches.length ? globMatches : project);
}, []);
break;
case 'moduleDirectories':
case 'testMatch':
value = (0, (_utils || _load_utils())._replaceRootDirTags)((0, (_utils || _load_utils()).escapeGlobCharacters)(options.rootDir), options[key]);
break;
case 'testRegex':
value = options[key] && (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)(options[key]);
break;
case 'automock':
case 'bail':
case 'browser':
case 'cache':
case 'changedSince':
case 'changedFilesWithAncestor':
case 'clearMocks':
case 'collectCoverage':
case 'coverageReporters':
case 'coverageThreshold':
case 'detectLeaks':
case 'displayName':
case 'expand':
case 'globals':
case 'findRelatedTests':
case 'forceCoverageMatch':
case 'forceExit':
case 'lastCommit':
case 'listTests':
case 'logHeapUsage':
case 'mapCoverage':
case 'moduleFileExtensions':
case 'name':
case 'noStackTrace':
case 'notify':
case 'notifyMode':
case 'onlyChanged':
case 'outputFile':
case 'passWithNoTests':
case 'replname':
case 'reporters':
case 'resetMocks':
case 'resetModules':
case 'restoreMocks':
case 'rootDir':
case 'runTestsByPath':
case 'silent':
case 'skipNodeResolution':
case 'testEnvironment':
case 'testEnvironmentOptions':
case 'testFailureExitCode':
case 'testLocationInResults':
case 'testNamePattern':
case 'testURL':
case 'timers':
case 'useStderr':
case 'verbose':
case 'watch':
case 'watchAll':
case 'watchman':
value = options[key];
break;
case 'watchPlugins':
value = (options[key] || []).map(watchPlugin => (0, (_utils || _load_utils()).resolve)(options.rootDir, key, watchPlugin));
break;
}
newOptions[key] = value;
return newOptions;
}, newOptions);
newOptions.nonFlagArgs = argv._;
newOptions.testPathPattern = buildTestPathPattern(argv);
newOptions.json = argv.json;
newOptions.testFailureExitCode = parseInt(newOptions.testFailureExitCode, 10);
for (const key of ['lastCommit', 'changedFilesWithAncestor', 'changedSince']) {
if (newOptions[key]) {
newOptions.onlyChanged = true;
}
}
if (argv.all) {
newOptions.onlyChanged = false;
} else if (newOptions.testPathPattern) {
// When passing a test path pattern we don't want to only monitor changed
// files unless `--watch` is also passed.
newOptions.onlyChanged = newOptions.watch;
}
newOptions.updateSnapshot = argv.ci && !argv.updateSnapshot ? 'none' : argv.updateSnapshot ? 'all' : 'new';
newOptions.maxWorkers = (0, (_get_max_workers || _load_get_max_workers()).default)(argv);
if (babelJest) {
const regeneratorRuntimePath = (_jestResolve || _load_jestResolve()).default.findNodeModule('regenerator-runtime/runtime', { basedir: options.rootDir });
if (regeneratorRuntimePath) {
newOptions.setupFiles.unshift(regeneratorRuntimePath);
}
}
if (options.testRegex && options.testMatch) {
throw createConfigError(` Configuration options ${(_chalk || _load_chalk()).default.bold('testMatch')} and` + ` ${(_chalk || _load_chalk()).default.bold('testRegex')} cannot be used together.`);
}
if (options.testRegex && !options.testMatch) {
// Prevent the default testMatch conflicting with any explicitly
// configured `testRegex` value
newOptions.testMatch = [];
}
// If argv.json is set, coverageReporters shouldn't print a text report.
if (argv.json) {
newOptions.coverageReporters = (newOptions.coverageReporters || []).filter(reporter => reporter !== 'text');
}
return {
hasDeprecationWarnings,
options: newOptions
};
}

View File

@@ -0,0 +1,76 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _jsonlint;
function _load_jsonlint() {
return _jsonlint = _interopRequireDefault(require('./vendor/jsonlint'));
}
var _constants;
function _load_constants() {
return _constants = require('./constants');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Read the configuration and set its `rootDir`
// 1. If it's a `package.json` file, we look into its "jest" property
// 2. For any other file, we just require it.
exports.default = configPath => {
const isJSON = configPath.endsWith('.json');
let configObject;
try {
// $FlowFixMe dynamic require
configObject = require(configPath);
} catch (error) {
if (isJSON) {
throw new Error(`Jest: Failed to parse config file ${configPath}\n` + ` ${(_jsonlint || _load_jsonlint()).default.errors((_fs || _load_fs()).default.readFileSync(configPath, 'utf8'))}`);
} else {
throw error;
}
}
if (configPath.endsWith((_constants || _load_constants()).PACKAGE_JSON)) {
// Event if there's no "jest" property in package.json we will still use
// an empty object.
configObject = configObject.jest || {};
}
if (configObject.rootDir) {
// We don't touch it if it has an absolute path specified
if (!(_path || _load_path()).default.isAbsolute(configObject.rootDir)) {
// otherwise, we'll resolve it relative to the file's __dirname
configObject.rootDir = (_path || _load_path()).default.resolve((_path || _load_path()).default.dirname(configPath), configObject.rootDir);
}
} else {
// If rootDir is not there, we'll set it to this file's __dirname
configObject.rootDir = (_path || _load_path()).default.dirname(configPath);
}
return configObject;
}; /**
* 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.
*
*
*/

View File

@@ -0,0 +1,91 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /**
* 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.
*
*/
exports.createReporterError = createReporterError;
exports.createArrayReporterError = createArrayReporterError;
exports.validateReporters = validateReporters;
var _jestValidate;
function _load_jestValidate() {
return _jestValidate = require('jest-validate');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _jestGetType;
function _load_jestGetType() {
return _jestGetType = _interopRequireDefault(require('jest-get-type'));
}
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const validReporterTypes = ['array', 'string'];
const ERROR = `${(_utils || _load_utils()).BULLET}Reporter Validation Error`;
/**
* Reporter Validation Error is thrown if the given arguments
* within the reporter are not valid.
*
* This is a highly specific reporter error and in the future will be
* merged with jest-validate. Till then, we can make use of it. It works
* and that's what counts most at this time.
*/
function createReporterError(reporterIndex, reporterValue) {
const errorMessage = ` Reporter at index ${reporterIndex} must be of type:\n` + ` ${(_chalk || _load_chalk()).default.bold.green(validReporterTypes.join(' or '))}\n` + ` but instead received:\n` + ` ${(_chalk || _load_chalk()).default.bold.red((0, (_jestGetType || _load_jestGetType()).default)(reporterValue))}`;
return new (_jestValidate || _load_jestValidate()).ValidationError(ERROR, errorMessage, (_utils || _load_utils()).DOCUMENTATION_NOTE);
}
function createArrayReporterError(arrayReporter, reporterIndex, valueIndex, value, expectedType, valueName) {
const errorMessage = ` Unexpected value for ${valueName} ` + `at index ${valueIndex} of reporter at index ${reporterIndex}\n` + ' Expected:\n' + ` ${(_chalk || _load_chalk()).default.bold.red(expectedType)}\n` + ' Got:\n' + ` ${(_chalk || _load_chalk()).default.bold.green((0, (_jestGetType || _load_jestGetType()).default)(value))}\n` + ` Reporter configuration:\n` + ` ${(_chalk || _load_chalk()).default.bold.green(JSON.stringify(arrayReporter, null, 2).split('\n').join('\n '))}`;
return new (_jestValidate || _load_jestValidate()).ValidationError(ERROR, errorMessage, (_utils || _load_utils()).DOCUMENTATION_NOTE);
}
function validateReporters(reporterConfig) {
return reporterConfig.every((reporter, index) => {
if (Array.isArray(reporter)) {
validateArrayReporter(reporter, index);
} else if (typeof reporter !== 'string') {
throw createReporterError(index, reporter);
}
return true;
});
}
function validateArrayReporter(arrayReporter, reporterIndex) {
var _arrayReporter = _slicedToArray(arrayReporter, 2);
const path = _arrayReporter[0],
options = _arrayReporter[1];
if (typeof path !== 'string') {
throw createArrayReporterError(arrayReporter, reporterIndex, 0, path, 'string', 'Path');
} else if (typeof options !== 'object') {
throw createArrayReporterError(arrayReporter, reporterIndex, 1, options, 'object', 'Reporter Configuration');
}
}

88
node_modules/jest-config/build/resolve_config_path.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _fs;
function _load_fs() {
return _fs = _interopRequireDefault(require('fs'));
}
var _constants;
function _load_constants() {
return _constants = require('./constants');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* 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.
*
*
*/
const isFile = filePath => (_fs || _load_fs()).default.existsSync(filePath) && !(_fs || _load_fs()).default.lstatSync(filePath).isDirectory();
exports.default = (pathToResolve, cwd) => {
if (!(_path || _load_path()).default.isAbsolute(cwd)) {
throw new Error(`"cwd" must be an absolute path. cwd: ${cwd}`);
}
const absolutePath = (_path || _load_path()).default.isAbsolute(pathToResolve) ? pathToResolve : (_path || _load_path()).default.resolve(cwd, pathToResolve);
if (isFile(absolutePath)) {
return absolutePath;
}
// This is a guard against passing non existing path as a project/config,
// that will otherwise result in a very confusing situation.
// e.g.
// With a directory structure like this:
// my_project/
// packcage.json
//
// Passing a `my_project/some_directory_that_doesnt_exist` as a project
// name will resolve into a (possibly empty) `my_project/package.json` and
// try to run all tests it finds under `my_project` directory.
if (!(_fs || _load_fs()).default.existsSync(absolutePath)) {
throw new Error(`Can't find a root directory while resolving a config file path.\n` + `Provided path to resolve: ${pathToResolve}\n` + `cwd: ${cwd}`);
}
return resolveConfigPathByTraversing(absolutePath, pathToResolve, cwd);
};
const resolveConfigPathByTraversing = (pathToResolve, initialPath, cwd) => {
const jestConfig = (_path || _load_path()).default.resolve(pathToResolve, (_constants || _load_constants()).JEST_CONFIG);
if (isFile(jestConfig)) {
return jestConfig;
}
const packageJson = (_path || _load_path()).default.resolve(pathToResolve, (_constants || _load_constants()).PACKAGE_JSON);
if (isFile(packageJson)) {
return packageJson;
}
// This is the system root.
// We tried everything, config is nowhere to be found ¯\_(ツ)_/¯
if (pathToResolve === (_path || _load_path()).default.dirname(pathToResolve)) {
throw new Error(makeResolutionErrorMessage(initialPath, cwd));
}
// go up a level and try it again
return resolveConfigPathByTraversing((_path || _load_path()).default.dirname(pathToResolve), initialPath, cwd);
};
const makeResolutionErrorMessage = (initialPath, cwd) => {
return 'Could not find a config file based on provided values:\n' + `path: "${initialPath}"\n` + `cwd: "${cwd}"\n` + 'Config paths must be specified by either a direct path to a config\n' + 'file, or a path to a directory. If directory is given, Jest will try to\n' + `traverse directory tree up, until it finds either "${(_constants || _load_constants()).JEST_CONFIG}" or\n` + `"${(_constants || _load_constants()).PACKAGE_JSON}".`;
};

59
node_modules/jest-config/build/set_from_argv.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = setFromArgv;
var _utils;
function _load_utils() {
return _utils = require('./utils');
}
/**
* 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.
*
*
*/
const specialArgs = ['_', '$0', 'h', 'help', 'config'];
function setFromArgv(options, argv) {
// $FlowFixMe: Seems like flow doesn't approve of string values
const argvToOptions = Object.keys(argv).filter(key => argv[key] !== undefined && specialArgs.indexOf(key) === -1).reduce((options, key) => {
switch (key) {
case 'coverage':
options.collectCoverage = argv[key];
break;
case 'json':
options.useStderr = argv[key];
break;
case 'watchAll':
options.watch = false;
options.watchAll = argv[key];
break;
case 'env':
options.testEnvironment = argv[key];
break;
case 'config':
break;
case 'coverageThreshold':
case 'globals':
case 'moduleNameMapper':
case 'transform':
case 'haste':
if ((0, (_utils || _load_utils()).isJSONString)(argv[key])) {
options[key] = JSON.parse(argv[key]);
}
break;
default:
options[key] = argv[key];
}
return options;
}, {});
return Object.assign({}, options, (0, (_utils || _load_utils()).isJSONString)(argv.config) ? JSON.parse(argv.config) : null, argvToOptions);
}

135
node_modules/jest-config/build/utils.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isJSONString = exports.getTestEnvironment = exports._replaceRootDirTags = exports._replaceRootDirInPath = exports.escapeGlobCharacters = exports.resolve = exports.DOCUMENTATION_NOTE = exports.BULLET = undefined;
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _jestValidate;
function _load_jestValidate() {
return _jestValidate = require('jest-validate');
}
var _jestResolve;
function _load_jestResolve() {
return _jestResolve = _interopRequireDefault(require('jest-resolve'));
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const BULLET = exports.BULLET = (_chalk || _load_chalk()).default.bold('\u25cf '); /**
* 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.
*
*
*/
const DOCUMENTATION_NOTE = exports.DOCUMENTATION_NOTE = ` ${(_chalk || _load_chalk()).default.bold('Configuration Documentation:')}
https://facebook.github.io/jest/docs/configuration.html
`;
const createValidationError = message => {
return new (_jestValidate || _load_jestValidate()).ValidationError(`${BULLET}Validation Error`, message, DOCUMENTATION_NOTE);
};
const resolve = exports.resolve = (rootDir, key, filePath) => {
const module = (_jestResolve || _load_jestResolve()).default.findNodeModule(_replaceRootDirInPath(rootDir, filePath), {
basedir: rootDir
});
if (!module) {
throw createValidationError(` Module ${(_chalk || _load_chalk()).default.bold(filePath)} in the ${(_chalk || _load_chalk()).default.bold(key)} option was not found.`);
}
return module;
};
const escapeGlobCharacters = exports.escapeGlobCharacters = path => {
return path.replace(/([()*{}\[\]!?\\])/g, '\\$1');
};
const _replaceRootDirInPath = exports._replaceRootDirInPath = (rootDir, filePath) => {
if (!/^<rootDir>/.test(filePath)) {
return filePath;
}
return (_path || _load_path()).default.resolve(rootDir, (_path || _load_path()).default.normalize('./' + filePath.substr('<rootDir>'.length)));
};
const _replaceRootDirInObject = (rootDir, config) => {
if (config !== null) {
const newConfig = {};
for (const configKey in config) {
newConfig[configKey] = configKey === 'rootDir' ? config[configKey] : _replaceRootDirTags(rootDir, config[configKey]);
}
return newConfig;
}
return config;
};
const _replaceRootDirTags = exports._replaceRootDirTags = (rootDir, config) => {
switch (typeof config) {
case 'object':
if (Array.isArray(config)) {
return config.map(item => _replaceRootDirTags(rootDir, item));
}
if (config instanceof RegExp) {
return config;
}
return _replaceRootDirInObject(rootDir, config);
case 'string':
return _replaceRootDirInPath(rootDir, config);
}
return config;
};
/**
* Finds the test environment to use:
*
* 1. looks for jest-environment-<name> relative to project.
* 1. looks for jest-environment-<name> relative to Jest.
* 1. looks for <name> relative to project.
* 1. looks for <name> relative to Jest.
*/
const getTestEnvironment = exports.getTestEnvironment = config => {
const env = _replaceRootDirInPath(config.rootDir, config.testEnvironment);
let module = (_jestResolve || _load_jestResolve()).default.findNodeModule(`jest-environment-${env}`, {
basedir: config.rootDir
});
if (module) {
return module;
}
try {
return require.resolve(`jest-environment-${env}`);
} catch (e) {}
module = (_jestResolve || _load_jestResolve()).default.findNodeModule(env, { basedir: config.rootDir });
if (module) {
return module;
}
try {
return require.resolve(env);
} catch (e) {}
throw createValidationError(` Test environment ${(_chalk || _load_chalk()).default.bold(env)} cannot be found. Make sure the ${(_chalk || _load_chalk()).default.bold('testEnvironment')} configuration option points to an existing node module.`);
};
const isJSONString = exports.isJSONString = text => text && typeof text === 'string' && text.startsWith('{') && text.endsWith('}');

116
node_modules/jest-config/build/valid_config.js generated vendored Normal file
View File

@@ -0,0 +1,116 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestRegexUtil;
function _load_jestRegexUtil() {
return _jestRegexUtil = require('jest-regex-util');
}
var _constants;
function _load_constants() {
return _constants = require('./constants');
}
const NODE_MODULES_REGEXP = (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)((_constants || _load_constants()).NODE_MODULES); /**
* 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.
*
*
*/
exports.default = {
automock: false,
bail: false,
browser: false,
cache: true,
cacheDirectory: '/tmp/user/jest',
changedFilesWithAncestor: false,
changedSince: '',
clearMocks: false,
collectCoverage: true,
collectCoverageFrom: ['src', '!public'],
collectCoverageOnlyFrom: {
'<rootDir>/this-directory-is-covered/Covered.js': true
},
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [NODE_MODULES_REGEXP],
coverageReporters: ['json', 'text', 'lcov', 'clover'],
coverageThreshold: {
global: {
branches: 50
}
},
displayName: 'project-name',
expand: false,
forceCoverageMatch: ['**/*.t.js'],
forceExit: false,
globalSetup: 'setup.js',
globalTeardown: 'teardown.js',
globals: {},
haste: {
providesModuleNodeModules: ['react', 'react-native']
},
json: false,
lastCommit: false,
logHeapUsage: true,
moduleDirectories: ['node_modules'],
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
moduleLoader: '<rootDir>',
moduleNameMapper: {
'^React$': '<rootDir>/node_modules/react'
},
modulePathIgnorePatterns: ['<rootDir>/build/'],
modulePaths: ['/shared/vendor/modules'],
name: 'string',
noStackTrace: false,
notify: false,
notifyMode: 'always',
onlyChanged: false,
preset: 'react-native',
projects: ['project-a', 'project-b/'],
reporters: ['default', 'custom-reporter-1', ['custom-reporter-2', { configValue: true }]],
resetMocks: false,
resetModules: false,
resolver: '<rootDir>/resolver.js',
restoreMocks: false,
rootDir: '/',
roots: ['<rootDir>'],
runTestsByPath: false,
runner: 'jest-runner',
setupFiles: ['<rootDir>/setup.js'],
setupTestFrameworkScriptFile: '<rootDir>/testSetupFile.js',
silent: true,
skipNodeResolution: false,
snapshotSerializers: ['my-serializer-module'],
testEnvironment: 'jest-environment-jsdom',
testEnvironmentOptions: {},
testFailureExitCode: 1,
testLocationInResults: false,
testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)'],
testNamePattern: 'test signature',
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$',
testResultsProcessor: 'processor-node-module',
testRunner: 'jasmine2',
testURL: 'about:blank',
timers: 'real',
transform: {
'^.+\\.js$': '<rootDir>/preprocessor.js'
},
transformIgnorePatterns: [NODE_MODULES_REGEXP],
unmockedModulePathPatterns: ['mock'],
updateSnapshot: true,
useStderr: false,
verbose: false,
watch: false,
watchPathIgnorePatterns: [],
watchPlugins: [],
watchman: true
};

27
node_modules/jest-config/build/validate_pattern.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = validatePattern;
/**
* 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.
*
*
*/
function validatePattern(pattern) {
if (pattern) {
try {
// eslint-disable-next-line no-new
new RegExp(pattern, 'i');
} catch (e) {
return false;
}
}
return true;
}

589
node_modules/jest-config/build/vendor/jsonlint.js generated vendored Normal file
View File

@@ -0,0 +1,589 @@
'use strict';
// From: https://github.com/zaach/jsonlint
// Vendored in Jest to avoid jsonlint's transitive dependencies.
/* eslint-disable */
var jsonlint = function () {
var parser = {
trace: function trace() {},
yy: {},
symbols_: {
error: 2,
JSONString: 3,
STRING: 4,
JSONNumber: 5,
NUMBER: 6,
JSONNullLiteral: 7,
NULL: 8,
JSONBooleanLiteral: 9,
TRUE: 10,
FALSE: 11,
JSONText: 12,
JSONValue: 13,
EOF: 14,
JSONObject: 15,
JSONArray: 16,
'{': 17,
'}': 18,
JSONMemberList: 19,
JSONMember: 20,
':': 21,
',': 22,
'[': 23,
']': 24,
JSONElementList: 25,
$accept: 0,
$end: 1
},
terminals_: {
2: 'error',
4: 'STRING',
6: 'NUMBER',
8: 'NULL',
10: 'TRUE',
11: 'FALSE',
14: 'EOF',
17: '{',
18: '}',
21: ':',
22: ',',
23: '[',
24: ']'
},
productions_: [0, [3, 1], [5, 1], [7, 1], [9, 1], [9, 1], [12, 2], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [15, 2], [15, 3], [20, 3], [19, 1], [19, 3], [16, 2], [16, 3], [25, 1], [25, 3]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
var $0 = $$.length - 1;
switch (yystate) {
case 1:
// replace escaped characters with actual character
this.$ = yytext.replace(/\\(\\|")/g, '$' + '1').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\v/g, '\v').replace(/\\f/g, '\f').replace(/\\b/g, '\b');
break;
case 2:
this.$ = Number(yytext);
break;
case 3:
this.$ = null;
break;
case 4:
this.$ = true;
break;
case 5:
this.$ = false;
break;
case 6:
return this.$ = $$[$0 - 1];
break;
case 13:
this.$ = {};
break;
case 14:
this.$ = $$[$0 - 1];
break;
case 15:
this.$ = [$$[$0 - 2], $$[$0]];
break;
case 16:
this.$ = {};
this.$[$$[$0][0]] = $$[$0][1];
break;
case 17:
this.$ = $$[$0 - 2];
$$[$0 - 2][$$[$0][0]] = $$[$0][1];
break;
case 18:
this.$ = [];
break;
case 19:
this.$ = $$[$0 - 1];
break;
case 20:
this.$ = [$$[$0]];
break;
case 21:
this.$ = $$[$0 - 2];
$$[$0 - 2].push($$[$0]);
break;
}
},
table: [{
3: 5,
4: [1, 12],
5: 6,
6: [1, 13],
7: 3,
8: [1, 9],
9: 4,
10: [1, 10],
11: [1, 11],
12: 1,
13: 2,
15: 7,
16: 8,
17: [1, 14],
23: [1, 15]
}, { 1: [3] }, { 14: [1, 16] }, { 14: [2, 7], 18: [2, 7], 22: [2, 7], 24: [2, 7] }, { 14: [2, 8], 18: [2, 8], 22: [2, 8], 24: [2, 8] }, { 14: [2, 9], 18: [2, 9], 22: [2, 9], 24: [2, 9] }, { 14: [2, 10], 18: [2, 10], 22: [2, 10], 24: [2, 10] }, { 14: [2, 11], 18: [2, 11], 22: [2, 11], 24: [2, 11] }, { 14: [2, 12], 18: [2, 12], 22: [2, 12], 24: [2, 12] }, { 14: [2, 3], 18: [2, 3], 22: [2, 3], 24: [2, 3] }, { 14: [2, 4], 18: [2, 4], 22: [2, 4], 24: [2, 4] }, { 14: [2, 5], 18: [2, 5], 22: [2, 5], 24: [2, 5] }, { 14: [2, 1], 18: [2, 1], 21: [2, 1], 22: [2, 1], 24: [2, 1] }, { 14: [2, 2], 18: [2, 2], 22: [2, 2], 24: [2, 2] }, { 3: 20, 4: [1, 12], 18: [1, 17], 19: 18, 20: 19 }, {
3: 5,
4: [1, 12],
5: 6,
6: [1, 13],
7: 3,
8: [1, 9],
9: 4,
10: [1, 10],
11: [1, 11],
13: 23,
15: 7,
16: 8,
17: [1, 14],
23: [1, 15],
24: [1, 21],
25: 22
}, { 1: [2, 6] }, { 14: [2, 13], 18: [2, 13], 22: [2, 13], 24: [2, 13] }, { 18: [1, 24], 22: [1, 25] }, { 18: [2, 16], 22: [2, 16] }, { 21: [1, 26] }, { 14: [2, 18], 18: [2, 18], 22: [2, 18], 24: [2, 18] }, { 22: [1, 28], 24: [1, 27] }, { 22: [2, 20], 24: [2, 20] }, { 14: [2, 14], 18: [2, 14], 22: [2, 14], 24: [2, 14] }, { 3: 20, 4: [1, 12], 20: 29 }, {
3: 5,
4: [1, 12],
5: 6,
6: [1, 13],
7: 3,
8: [1, 9],
9: 4,
10: [1, 10],
11: [1, 11],
13: 30,
15: 7,
16: 8,
17: [1, 14],
23: [1, 15]
}, { 14: [2, 19], 18: [2, 19], 22: [2, 19], 24: [2, 19] }, {
3: 5,
4: [1, 12],
5: 6,
6: [1, 13],
7: 3,
8: [1, 9],
9: 4,
10: [1, 10],
11: [1, 11],
13: 31,
15: 7,
16: 8,
17: [1, 14],
23: [1, 15]
}, { 18: [2, 17], 22: [2, 17] }, { 18: [2, 15], 22: [2, 15] }, { 22: [2, 21], 24: [2, 21] }],
defaultActions: { 16: [2, 6] },
parseError: function parseError(str, hash) {
throw new Error(str);
},
parse: function parse(input) {
var self = this,
stack = [0],
vstack = [null],
// semantic value stack
lstack = [],
// location stack
table = this.table,
yytext = '',
yylineno = 0,
yyleng = 0,
recovering = 0,
TERROR = 2,
EOF = 1;
//this.reductionCount = this.shiftCount = 0;
this.lexer.setInput(input);
this.lexer.yy = this.yy;
this.yy.lexer = this.lexer;
if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {};
var yyloc = this.lexer.yylloc;
lstack.push(yyloc);
if (typeof this.yy.parseError === 'function') this.parseError = this.yy.parseError;
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
function lex() {
var token;
token = self.lexer.lex() || 1; // $end = 1
// if token isn't its numeric value, convert
if (typeof token !== 'number') {
token = self.symbols_[token] || token;
}
return token;
}
var symbol,
preErrorSymbol,
state,
action,
a,
r,
yyval = {},
p,
len,
newState,
expected;
while (true) {
// retrieve state number from top of stack
state = stack[stack.length - 1];
// use default actions if available
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol == null) symbol = lex();
// read action for current state and first input
action = table[state] && table[state][symbol];
}
// handle parse error
_handle_error: if (typeof action === 'undefined' || !action.length || !action[0]) {
if (!recovering) {
// Report error
expected = [];
for (p in table[state]) if (this.terminals_[p] && p > 2) {
expected.push("'" + this.terminals_[p] + "'");
}
var errStr = '';
if (this.lexer.showPosition) {
errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + this.terminals_[symbol] + "'";
} else {
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == 1 /*EOF*/
? 'end of input' : "'" + (this.terminals_[symbol] || symbol) + "'");
}
this.parseError(errStr, {
text: this.lexer.match,
token: this.terminals_[symbol] || symbol,
line: this.lexer.yylineno,
loc: yyloc,
expected: expected
});
}
// just recovered from another error
if (recovering == 3) {
if (symbol == EOF) {
throw new Error(errStr || 'Parsing halted.');
}
// discard current lookahead and grab another
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
symbol = lex();
}
// try to recover from error
while (1) {
// check for error recovery rule in this state
if (TERROR.toString() in table[state]) {
break;
}
if (state == 0) {
throw new Error(errStr || 'Parsing halted.');
}
popStack(1);
state = stack[stack.length - 1];
}
preErrorSymbol = symbol; // save the lookahead token
symbol = TERROR; // insert generic error symbol as new lookahead
state = stack[stack.length - 1];
action = table[state] && table[state][TERROR];
recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
}
// this shouldn't happen, unless resolve defaults are off
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
}
switch (action[0]) {
case 1:
// shift
//this.shiftCount++;
stack.push(symbol);
vstack.push(this.lexer.yytext);
lstack.push(this.lexer.yylloc);
stack.push(action[1]); // push state
symbol = null;
if (!preErrorSymbol) {
// normal execution/no error
yyleng = this.lexer.yyleng;
yytext = this.lexer.yytext;
yylineno = this.lexer.yylineno;
yyloc = this.lexer.yylloc;
if (recovering > 0) recovering--;
} else {
// error just occurred, resume old lookahead f/ before error
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
// reduce
//this.reductionCount++;
len = this.productions_[action[1]][1];
// perform semantic action
yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
// default location, uses first token for firsts, last for lasts
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
if (typeof r !== 'undefined') {
return r;
}
// pop off stack
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
vstack.push(yyval.$);
lstack.push(yyval._$);
// goto new state = table[STATE][NONTERMINAL]
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
// accept
return true;
}
}
return true;
}
};
/* Jison generated lexer */
var lexer = function () {
var lexer = {
EOF: 1,
parseError: function parseError(str, hash) {
if (this.yy.parseError) {
this.yy.parseError(str, hash);
} else {
throw new Error(str);
}
},
setInput: function (input) {
this._input = input;
this._more = this._less = this.done = false;
this.yylineno = this.yyleng = 0;
this.yytext = this.matched = this.match = '';
this.conditionStack = ['INITIAL'];
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
};
return this;
},
input: function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/\n/);
if (lines) this.yylineno++;
this._input = this._input.slice(1);
return ch;
},
unput: function (ch) {
this._input = ch + this._input;
return this;
},
more: function () {
this._more = true;
return this;
},
less: function (n) {
this._input = this.match.slice(n) + this._input;
},
pastInput: function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, '');
},
upcomingInput: function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20 - next.length);
}
return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, '');
},
showPosition: function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join('-');
return pre + this.upcomingInput() + '\n' + c + '^';
},
next: function () {
if (this.done) {
return this.EOF;
}
if (!this._input) this.done = true;
var token, match, tempMatch, index, col, lines;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (!this.options.flex) break;
}
}
if (match) {
lines = match[0].match(/\n.*/g);
if (lines) this.yylineno += lines.length;
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ? lines[lines.length - 1].length - 1 : this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.yyleng = this.yytext.length;
this._more = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) this.done = false;
if (token) return token;else return;
}
if (this._input === '') {
return this.EOF;
} else {
this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: '', token: null, line: this.yylineno });
}
},
lex: function lex() {
var r = this.next();
if (typeof r !== 'undefined') {
return r;
} else {
return this.lex();
}
},
begin: function begin(condition) {
this.conditionStack.push(condition);
},
popState: function popState() {
return this.conditionStack.pop();
},
_currentRules: function _currentRules() {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
},
topState: function () {
return this.conditionStack[this.conditionStack.length - 2];
},
pushState: function begin(condition) {
this.begin(condition);
}
};
lexer.options = {};
lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
var YYSTATE = YY_START;
switch ($avoiding_name_collisions) {
case 0 /* skip whitespace */:
break;
case 1:
return 6;
break;
case 2:
yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2);
return 4;
break;
case 3:
return 17;
break;
case 4:
return 18;
break;
case 5:
return 23;
break;
case 6:
return 24;
break;
case 7:
return 22;
break;
case 8:
return 21;
break;
case 9:
return 10;
break;
case 10:
return 11;
break;
case 11:
return 8;
break;
case 12:
return 14;
break;
case 13:
return 'INVALID';
break;
}
};
lexer.rules = [/^(?:\s+)/, /^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/, /^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/, /^(?:\{)/, /^(?:\})/, /^(?:\[)/, /^(?:\])/, /^(?:,)/, /^(?::)/, /^(?:true\b)/, /^(?:false\b)/, /^(?:null\b)/, /^(?:$)/, /^(?:.)/];
lexer.conditions = {
INITIAL: {
rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
inclusive: true
}
};
return lexer;
}();
parser.lexer = lexer;
return parser;
}();
exports.parser = jsonlint;
exports.errors = function (input) {
try {
this.parse(input);
} catch (e) {
return e.stack;
}
};
exports.parse = function () {
return jsonlint.parse.apply(jsonlint, arguments);
};
exports.main = function commonjsMain(args) {
if (!args[1]) throw new Error('Usage: ' + args[0] + ' FILE');
if (typeof process !== 'undefined') {
var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), 'utf8');
} else {
var cwd = require('file').path(require('file').cwd());
var source = cwd.join(args[1]).read({ charset: 'utf-8' });
}
return exports.parser.parse(source);
};