diff --git a/CHANGELOG.md b/CHANGELOG.md index f7aeb913b2ab..38362c8b9252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/CLI.md b/docs/CLI.md index f57c83cc0988..033fa6a83069 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -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. diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index b29d6cb5fa8a..8022f9b9c09c 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -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:^", diff --git a/packages/jest-cli/src/args.ts b/packages/jest-cli/src/args.ts index 56d21754c926..869f1a0a707f 100644 --- a/packages/jest-cli/src/args.ts +++ b/packages/jest-cli/src/args.ts @@ -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', diff --git a/packages/jest-cli/src/run.ts b/packages/jest-cli/src/run.ts index 1f08f7931cf4..3c6babcbe921 100644 --- a/packages/jest-cli/src/run.ts +++ b/packages/jest-cli/src/run.ts @@ -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'; @@ -24,12 +23,6 @@ export async function run( ): Promise { try { const argv = await buildArgv(maybeArgv); - - if (argv.init) { - await runCreate(); - return; - } - const projects = getProjectListFromCLIArgs(argv, project); const {results, globalConfig} = await runCLI(argv, projects); diff --git a/packages/jest-cli/tsconfig.json b/packages/jest-cli/tsconfig.json index dabfdb21d4c4..32f96c0f8a77 100644 --- a/packages/jest-cli/tsconfig.json +++ b/packages/jest-cli/tsconfig.json @@ -7,7 +7,6 @@ "include": ["./src/**/*"], "exclude": ["./**/__tests__/**/*"], "references": [ - {"path": "../create-jest"}, {"path": "../jest-config"}, {"path": "../jest-core"}, {"path": "../jest-test-result"}, diff --git a/packages/jest-config/src/Deprecated.ts b/packages/jest-config/src/Deprecated.ts index e1f3239a833f..be90f76d75d6 100644 --- a/packages/jest-config/src/Deprecated.ts +++ b/packages/jest-config/src/Deprecated.ts @@ -28,6 +28,11 @@ const deprecatedOptions: DeprecatedOptions = { Please update your configuration.`, + init: () => + ` 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"')}. diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index 307dee61f30a..589e7b6cd3f3 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -526,7 +526,6 @@ export type Argv = Arguments< globalTeardown: string | null | undefined; haste: string; ignoreProjects: Array; - init: boolean; injectGlobals: boolean; json: boolean; lastCommit: boolean; diff --git a/yarn.lock b/yarn.lock index 03a1c01e0684..65694401a3c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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: @@ -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:^"