From ba1366b8c04c49f07a50e6c9cf7f8dd18bb4c1c3 Mon Sep 17 00:00:00 2001 From: Aftabnack Date: Tue, 13 Feb 2018 00:21:00 +0530 Subject: [PATCH] Moving validate_cli_options from jest-util to jest-validate --- packages/jest-cli/package.json | 1 + packages/jest-cli/src/cli/index.js | 8 ++------ packages/jest-repl/package.json | 2 +- packages/jest-repl/src/cli/index.js | 2 +- packages/jest-runtime/package.json | 1 + packages/jest-runtime/src/cli/index.js | 3 ++- packages/jest-util/src/index.js | 2 -- .../__snapshots__/validate_cli_options.test.js.snap | 0 .../src/__tests__/validate_cli_options.test.js | 0 packages/jest-validate/src/index.js | 2 ++ .../src/validate_cli_options.js | 7 ++++++- 11 files changed, 16 insertions(+), 12 deletions(-) rename packages/{jest-util => jest-validate}/src/__tests__/__snapshots__/validate_cli_options.test.js.snap (100%) rename packages/{jest-util => jest-validate}/src/__tests__/validate_cli_options.test.js (100%) rename packages/{jest-util => jest-validate}/src/validate_cli_options.js (94%) diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index e2420ef57553..d9fa33500430 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -27,6 +27,7 @@ "jest-runtime": "^22.3.0", "jest-snapshot": "^22.2.0", "jest-util": "^22.3.0", + "jest-validate": "^22.3.0", "jest-worker": "^22.2.2", "micromatch": "^2.3.11", "node-notifier": "^5.2.1", diff --git a/packages/jest-cli/src/cli/index.js b/packages/jest-cli/src/cli/index.js index 42d39276331e..99ae6384555e 100644 --- a/packages/jest-cli/src/cli/index.js +++ b/packages/jest-cli/src/cli/index.js @@ -11,12 +11,8 @@ import type {AggregatedResult} from 'types/TestResult'; import type {Argv} from 'types/Argv'; import type {GlobalConfig, Path, ProjectConfig} from 'types/Config'; -import { - Console, - clearLine, - createDirectory, - validateCLIOptions, -} from 'jest-util'; +import {Console, clearLine, createDirectory} from 'jest-util'; +import {validateCLIOptions} from 'jest-validate'; import {readConfig} from 'jest-config'; import {version as VERSION} from '../../package.json'; import * as args from './args'; diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index ffcf819e9817..2194f887dfd4 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -9,7 +9,7 @@ "main": "build/index.js", "dependencies": { "jest-runtime": "^22.3.0", - "jest-util": "^22.3.0", + "jest-validate": "^22.3.0", "repl": "^0.1.3", "yargs": "^10.0.3" }, diff --git a/packages/jest-repl/src/cli/index.js b/packages/jest-repl/src/cli/index.js index 1f6098b3bdcb..7879498040c7 100644 --- a/packages/jest-repl/src/cli/index.js +++ b/packages/jest-repl/src/cli/index.js @@ -12,7 +12,7 @@ import path from 'path'; import Runtime from 'jest-runtime'; import yargs from 'yargs'; -import {validateCLIOptions} from 'jest-util'; +import {validateCLIOptions} from 'jest-validate'; import {version as VERSION} from '../../package.json'; import * as args from './args'; diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 2417df7f71df..6eee9c4ac389 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -20,6 +20,7 @@ "jest-regex-util": "^22.1.0", "jest-resolve": "^22.3.0", "jest-util": "^22.3.0", + "jest-validate": "^22.3.0", "json-stable-stringify": "^1.0.1", "micromatch": "^2.3.11", "realpath-native": "^1.0.0", diff --git a/packages/jest-runtime/src/cli/index.js b/packages/jest-runtime/src/cli/index.js index a936d5879b14..1d16429b097d 100644 --- a/packages/jest-runtime/src/cli/index.js +++ b/packages/jest-runtime/src/cli/index.js @@ -14,7 +14,8 @@ import chalk from 'chalk'; import os from 'os'; import path from 'path'; import yargs from 'yargs'; -import {Console, setGlobal, validateCLIOptions} from 'jest-util'; +import {Console, setGlobal} from 'jest-util'; +import {validateCLIOptions} from 'jest-validate'; import {readConfig} from 'jest-config'; // eslint-disable-next-line import/default import Runtime from '../'; diff --git a/packages/jest-util/src/index.js b/packages/jest-util/src/index.js index 0a238fc15800..1b3a6cf27b20 100644 --- a/packages/jest-util/src/index.js +++ b/packages/jest-util/src/index.js @@ -20,7 +20,6 @@ import installCommonGlobals from './install_common_globals'; import NullConsole from './null_console'; import isInteractive from './is_interative'; import setGlobal from './set_global'; -import validateCLIOptions from './validate_cli_options'; import deepCyclicCopy from './deep_cyclic_copy'; const createDirectory = (path: string) => { @@ -47,5 +46,4 @@ module.exports = { installCommonGlobals, isInteractive, setGlobal, - validateCLIOptions, }; diff --git a/packages/jest-util/src/__tests__/__snapshots__/validate_cli_options.test.js.snap b/packages/jest-validate/src/__tests__/__snapshots__/validate_cli_options.test.js.snap similarity index 100% rename from packages/jest-util/src/__tests__/__snapshots__/validate_cli_options.test.js.snap rename to packages/jest-validate/src/__tests__/__snapshots__/validate_cli_options.test.js.snap diff --git a/packages/jest-util/src/__tests__/validate_cli_options.test.js b/packages/jest-validate/src/__tests__/validate_cli_options.test.js similarity index 100% rename from packages/jest-util/src/__tests__/validate_cli_options.test.js rename to packages/jest-validate/src/__tests__/validate_cli_options.test.js diff --git a/packages/jest-validate/src/index.js b/packages/jest-validate/src/index.js index 91c3f46fdf95..c17c0c3797b1 100644 --- a/packages/jest-validate/src/index.js +++ b/packages/jest-validate/src/index.js @@ -14,6 +14,7 @@ import { ValidationError, } from './utils'; import validate from './validate'; +import validateCLIOptions from './validate_cli_options'; module.exports = { ValidationError, @@ -21,4 +22,5 @@ module.exports = { format, logValidationWarning, validate, + validateCLIOptions, }; diff --git a/packages/jest-util/src/validate_cli_options.js b/packages/jest-validate/src/validate_cli_options.js similarity index 94% rename from packages/jest-util/src/validate_cli_options.js rename to packages/jest-validate/src/validate_cli_options.js index 78551d8fdc41..98cd50e5de24 100644 --- a/packages/jest-util/src/validate_cli_options.js +++ b/packages/jest-validate/src/validate_cli_options.js @@ -10,7 +10,12 @@ import type {Argv} from 'types/Argv'; import chalk from 'chalk'; -import {ValidationError, format, createDidYouMeanMessage} from 'jest-validate'; +import { + createDidYouMeanMessage, + format, + logValidationWarning, + ValidationError, +} from './utils'; const BULLET: string = chalk.bold('\u25cf');