Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject deprecationEntries from jest-config to jest-validate. #6067

Merged
merged 7 commits into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/packages/*/build-es5/
/packages/*/coverage/
/packages/*/node_modules/
/packages/*/package-lock.json

/website/build
/website/node_modules
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

### Features

* `[jest-config]` According to #5828, moves `deprecationEntries` from
`jest-config` to `jest-validate`.
([#6067](https://github.com/facebook/jest/pull/6067))
* `[jest-validate]` According to #5828, moves `deprecationEntries` from
`jest-config` to `jest-validate`.
Copy link
Member

Choose a reason for hiding this comment

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

Is this line duplicated?

Copy link
Member

Choose a reason for hiding this comment

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

Might be helpful to link to #5828 (though I'm not sure it's necessary to mention)

Copy link
Author

Choose a reason for hiding this comment

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

@rickhanlonii Well, there are mentions to two packages. As I wasn't sure if this would be used to an auto-generated doc, I duplicated just like

[expect] Add stack trace for async errors (#6008)
[jest-jasmine2] Add stack trace for timeouts (#6008)

few lines below

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I should read closer, thanks!

Copy link
Author

Choose a reason for hiding this comment

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

No worries, and thanks for checking it out!

([#6067](https://github.com/facebook/jest/pull/6067))
* `[jest-runtime]` Fix typo.
Copy link
Member

Choose a reason for hiding this comment

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

if this is included, it should be under chores. but don't think a typo fix needs to be in the changelog, especially as it's not user visible (the typo wasn't in a message show to the user.)

Copy link
Author

Choose a reason for hiding this comment

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

Just removed it! 😁

([#6067](https://github.com/facebook/jest/pull/6067))
* `[jest-snapshot]` [**BREAKING**] Concatenate name of test, optional snapshot
name and count ([#6015](https://github.com/facebook/jest/pull/6015))
* `[jest-runtime]` Allow for transform plugins to skip the definition process
Expand Down
7 changes: 5 additions & 2 deletions packages/jest-cli/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {GlobalConfig, Path, ProjectConfig} from 'types/Config';

import {Console, clearLine, createDirectory} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
import {readConfig} from 'jest-config';
import {readConfig, deprecationEntries} from 'jest-config';
import {version as VERSION} from '../../package.json';
import * as args from './args';
import chalk from 'chalk';
Expand Down Expand Up @@ -126,7 +126,10 @@ const buildArgv = (maybeArgv: ?Argv, project: ?Path) => {
.check(args.check)
.version(false).argv;

validateCLIOptions(argv, args.options);
validateCLIOptions(
argv,
Object.assign({}, args.options, {deprecationEntries}),
);

return argv;
};
Expand Down
1 change: 1 addition & 0 deletions packages/jest-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"license": "MIT",
"main": "build/index.js",
"dependencies": {
"jest-config": "^22.4.2",
"jest-runtime": "^22.4.2",
"jest-validate": "^22.4.2",
"repl": "^0.1.3",
Expand Down
6 changes: 5 additions & 1 deletion packages/jest-repl/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import path from 'path';
import Runtime from 'jest-runtime';
import yargs from 'yargs';
import {validateCLIOptions} from 'jest-validate';
import {deprecationEntries} from 'jest-config';
import {version as VERSION} from '../../package.json';
import * as args from './args';

Expand All @@ -21,7 +22,10 @@ const REPL_SCRIPT = path.resolve(__dirname, './repl.js');
module.exports = function() {
const argv = yargs.usage(args.usage).options(args.options).argv;

validateCLIOptions(argv, args.options);
validateCLIOptions(
argv,
Object.assign({}, args.options, {deprecationEntries}),
);

argv._ = [REPL_SCRIPT];

Expand Down
7 changes: 5 additions & 2 deletions packages/jest-runtime/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import path from 'path';
import yargs from 'yargs';
import {Console, setGlobal} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
import {readConfig} from 'jest-config';
import {readConfig, deprecationEntries} from 'jest-config';
// eslint-disable-next-line import/default
import Runtime from '../';
import * as args from './args';
Expand All @@ -38,7 +38,10 @@ export function run(cliArgv?: Argv, cliInfo?: Array<string>) {
.version(false)
.options(args.options).argv;

validateCLIOptions(argv, args.options);
validateCLIOptions(
argv,
Object.assign({}, args.options, {deprecationEntries}),
);
}

if (argv.help) {
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: 1 addition & 1 deletion packages/jest-validate/src/validate_cli_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
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 defaultConfig from './default_config';
Expand Down Expand Up @@ -68,6 +67,7 @@ const logDeprecatedOptions = (

export default function validateCLIOptions(argv: Argv, options: Object) {
const yargsSpecialOptions = ['$0', '_', 'help', 'h'];
const deprecationEntries = options.deprecationEntries || {};
const allowedOptions = Object.keys(options).reduce(
(acc, option) => acc.add(option).add(options[option].alias || option),
new Set(yargsSpecialOptions),
Expand Down