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

chore(jest-cli): Deprecation of the --init argument #14490

Merged
merged 7 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
### Chore & Maintenance

- `[*]` [**BREAKING**] Drop support for Node.js versions 14 and 19 ([#14460](https://github.com/jestjs/jest/pull/14460))
- `[jest-cli, jest-config, @jest/types]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490))

## 29.7.0

Expand Down
4 changes: 0 additions & 4 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,6 @@ Show the help information, similar to this page.

Ignore the tests of the specified projects. Jest uses the attribute `displayName` in the configuration to identify each project. If you use this option, you should provide a `displayName` to all your projects.

### `--init`

Generate a basic configuration file. Based on your project, Jest will ask you a few questions that will help to generate a `jest.config.js` file with a short description for each option.

### `--injectGlobals`

Insert Jest's globals (`expect`, `test`, `describe`, `beforeEach` etc.) into the global environment. If you set this to `false`, you should import from `@jest/globals`, e.g.
Expand Down
1 change: 0 additions & 1 deletion packages/jest-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@jest/test-result": "workspace:^",
"@jest/types": "workspace:^",
"chalk": "^4.0.0",
"create-jest": "workspace:^",
"exit": "^0.1.2",
"import-local": "^3.0.2",
"jest-config": "workspace:^",
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-cli/src/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ export const options: {[key: string]: Options} = {
string: true,
type: 'array',
},
init: {
description: 'Generate a basic configuration file',
type: 'boolean',
},
injectGlobals: {
description: 'Should Jest inject global variables or not',
type: 'boolean',
Expand Down
7 changes: 0 additions & 7 deletions packages/jest-cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import yargs = require('yargs');
import {getVersion, runCLI} from '@jest/core';
import type {AggregatedResult} from '@jest/test-result';
import type {Config} from '@jest/types';
import {runCreate} from 'create-jest';
import {deprecationEntries} from 'jest-config';
import {clearLine, tryRealpath} from 'jest-util';
import {validateCLIOptions} from 'jest-validate';
Expand All @@ -24,12 +23,6 @@ export async function run(
): Promise<void> {
try {
const argv = await buildArgv(maybeArgv);

if (argv.init) {
await runCreate();
return;
}

const projects = getProjectListFromCLIArgs(argv, project);

const {results, globalConfig} = await runCLI(argv, projects);
Expand Down
1 change: 0 additions & 1 deletion packages/jest-cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"include": ["./src/**/*"],
"exclude": ["./**/__tests__/**/*"],
"references": [
{"path": "../create-jest"},
{"path": "../jest-config"},
{"path": "../jest-core"},
{"path": "../jest-test-result"},
Expand Down
5 changes: 5 additions & 0 deletions packages/jest-config/src/Deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ const deprecatedOptions: DeprecatedOptions = {

Please update your configuration.`,

init: () =>
dj-stormtrooper marked this conversation as resolved.
Show resolved Hide resolved
` Option ${chalk.bold(
'"init"',
)} has been deprecated. Please use "create-jest" package as shown in the documentation: https://jestjs.io/docs/getting-started#generate-a-basic-configuration-file`,

moduleLoader: (_options: {moduleLoader?: string}) => ` Option ${chalk.bold(
'"moduleLoader"',
)} was replaced by ${chalk.bold('"runtime"')}.
Expand Down
1 change: 0 additions & 1 deletion packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ export type Argv = Arguments<
globalTeardown: string | null | undefined;
haste: string;
ignoreProjects: Array<string>;
init: boolean;
injectGlobals: boolean;
json: boolean;
lastCommit: boolean;
Expand Down
3 changes: 1 addition & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8001,7 +8001,7 @@ __metadata:
languageName: node
linkType: hard

"create-jest@workspace:^, create-jest@workspace:packages/create-jest":
"create-jest@workspace:packages/create-jest":
version: 0.0.0-use.local
resolution: "create-jest@workspace:packages/create-jest"
dependencies:
Expand Down Expand Up @@ -12474,7 +12474,6 @@ __metadata:
"@types/exit": ^0.1.30
"@types/yargs": ^17.0.8
chalk: ^4.0.0
create-jest: "workspace:^"
exit: ^0.1.2
import-local: ^3.0.2
jest-config: "workspace:^"
Expand Down
Loading