Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move deprecationEntries from jest-config to jest-validate.
Also fix a typo on `jest-runtime`
  • Loading branch information
Sid Ferreira committed Apr 25, 2018
commit 61e95ee93d01c9d2891c7b27c3c2db8dfe67b670
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ lerna-debug.log
npm-debug.log
npm-debug.log*
yarn-error.log*
package-lock.json
1 change: 0 additions & 1 deletion packages/jest-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import readConfigFileAndSetRootDir from './read_config_file_and_set_root_dir';

export {getTestEnvironment, isJSONString} from './utils';
export {default as normalize} from './normalize';
export {default as deprecationEntries} from './deprecated';
export {replaceRootDirInPath} from './utils';
export {default as defaults} from './defaults';

Expand Down
7 changes: 5 additions & 2 deletions packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import type {InitialOptions, ReporterConfig} from 'types/Config';
import crypto from 'crypto';
import glob from 'glob';
import path from 'path';
import {ValidationError, validate} from 'jest-validate';
import {
ValidationError,
validate,
deprecationEntries as DEPRECATED_CONFIG,
} from 'jest-validate';
import validatePattern from './validate_pattern';
import {clearLine} from 'jest-util';
import chalk from 'chalk';
Expand All @@ -32,7 +36,6 @@ import {
import {DEFAULT_JS_PATTERN, DEFAULT_REPORTER_LABEL} from './constants';
import {validateReporters} from './reporter_validation_errors';
import DEFAULT_CONFIG from './defaults';
import DEPRECATED_CONFIG from './deprecated';
import setFromArgv from './set_from_argv';
import VALID_CONFIG from './valid_config';
const ERROR = `${BULLET}Validation Error`;
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import fs from 'graceful-fs';
import stripBOM from 'strip-bom';
import ScriptTransformer from './script_transformer';
import shouldInstrument from './should_instrument';
import {run as cilRun} from './cli';
import {run as cliRun} from './cli';
import {options as cliOptions} from './cli/args';

type Module = {|
Expand Down Expand Up @@ -261,7 +261,7 @@ class Runtime {
}

static runCLI(args?: Argv, info?: Array<string>) {
return cilRun(args, info);
return cliRun(args, info);
}

static getCLIOptions() {
Expand Down
1 change: 0 additions & 1 deletion packages/jest-validate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"main": "build/index.js",
"dependencies": {
"chalk": "^2.0.1",
"jest-config": "^22.4.2",
"jest-get-type": "^22.1.0",
"leven": "^2.1.0",
"pretty-format": "^22.4.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-validate/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
} from './utils';
import validate from './validate';
import validateCLIOptions from './validate_cli_options';
import deprecationEntries from './deprecationEntries';

module.exports = {
ValidationError,
createDidYouMeanMessage,
deprecationEntries,
format,
logValidationWarning,
validate,
Expand Down
8 changes: 4 additions & 4 deletions packages/jest-validate/src/validate_cli_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import type {Argv} from 'types/Argv';

import chalk from 'chalk';
import {deprecationEntries} from 'jest-config';
import {createDidYouMeanMessage, format, ValidationError} from './utils';
import {deprecationWarning} from './deprecated';
import CLIDeprecationEntries from './deprecationEntries';
import defaultConfig from './default_config';

const BULLET: string = chalk.bold('\u25cf');
Expand Down Expand Up @@ -80,12 +80,12 @@ export default function validateCLIOptions(argv: Argv, options: Object) {
throw createCLIValidationError(unrecognizedOptions, allowedOptions);
}

const CLIDeprecations = Object.keys(deprecationEntries).reduce(
const CLIDeprecations = Object.keys(CLIDeprecationEntries).reduce(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think jest-config should pass deprecationEntries into jest-validate, they don't have to live in jest-validate. If I use jest-validate for config validation in my own module, I don't care about jest's deprecations

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimenB that was the previous behavior... But caused the deadlock.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I renamed to CLIDeprecationEntries because there's another variable with the similar name. It was confusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest-validate imported it from jest-config - I think jest-config should explicitly pass it to jest-validate

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimenB make sense

(acc, entry) => {
if (options[entry]) {
acc[entry] = deprecationEntries[entry];
acc[entry] = CLIDeprecationEntries[entry];
if (options[entry].alias) {
acc[options[entry].alias] = deprecationEntries[entry];
acc[options[entry].alias] = CLIDeprecationEntries[entry];
}
}
return acc;
Expand Down