From 3f2276ccf82dbe342f84694215ff49035af002ac Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Thu, 7 Sep 2023 13:55:26 +0400 Subject: [PATCH 1/5] chore(jest-cli): Deprecation of `--init`argument in favor of `create-jest` package --- docs/CLI.md | 4 ---- packages/jest-cli/package.json | 1 - packages/jest-cli/src/args.ts | 4 ---- packages/jest-cli/src/run.ts | 7 ------- packages/jest-cli/tsconfig.json | 1 - packages/jest-types/src/Config.ts | 1 - yarn.lock | 3 +-- 7 files changed, 1 insertion(+), 20 deletions(-) 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 e2e641829e9b..ac0b78b26fa7 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 6b68efb15df5..98fa78cd175a 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-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 20ae53133c8b..e7000cbd12cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8021,7 +8021,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: @@ -12417,7 +12417,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:^" From b5f2049995029f774381c8c57ea28e96dae8c591 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Thu, 7 Sep 2023 14:11:08 +0400 Subject: [PATCH 2/5] docs: Changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce2bc5c5d9c..6a9c581e6c9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ ### Chore & Maintenance - `[jest-cli]` Move internal config initialisation logic to the `create-jest` package ([#14465](https://github.com/jestjs/jest/pull/14453)) +- `[jest-cli]` [**BREAKING**] Remove deprecated `--init` argument ([#9968](https://github.com/jestjs/jest/pull/14490)) +- `[jest-types]` [**BREAKING**] Remove deprecated `init` option ([#9968](https://github.com/jestjs/jest/pull/14490)) ## 29.6.4 From 2eaaa2f2303b52a630150e64a32374528f809c8a Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Thu, 7 Sep 2023 16:10:39 +0400 Subject: [PATCH 3/5] chore: Add deprecation notice to `--init` users --- packages/jest-config/src/Deprecated.ts | 5 +++++ 1 file changed, 5 insertions(+) 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"')}. From 9abd4a17e5db654ebdaddba0a7be305ae06efe61 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Thu, 7 Sep 2023 16:28:40 +0400 Subject: [PATCH 4/5] docs: Changelog update --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a9c581e6c9e..e0698fcc7dfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,9 @@ ### Chore & Maintenance - `[jest-cli]` Move internal config initialisation logic to the `create-jest` package ([#14465](https://github.com/jestjs/jest/pull/14453)) -- `[jest-cli]` [**BREAKING**] Remove deprecated `--init` argument ([#9968](https://github.com/jestjs/jest/pull/14490)) -- `[jest-types]` [**BREAKING**] Remove deprecated `init` option ([#9968](https://github.com/jestjs/jest/pull/14490)) +- `[jest-cli]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490)) +- `[jest-types]` [**BREAKING**] Remove deprecated `init` option ([#14490](https://github.com/jestjs/jest/pull/14490)) +- `[jest-config]` Add deprecation notice for the `init` option ([#14490](https://github.com/jestjs/jest/pull/14490)) ## 29.6.4 From 17abf4073bcfdc129d1cc9432768de68eb09c039 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 19 Sep 2023 10:31:05 +0200 Subject: [PATCH 5/5] move changelog entry --- CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f4f31fc98e6..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 @@ -34,9 +35,6 @@ ### Chore & Maintenance - `[jest-cli]` Move internal config initialisation logic to the `create-jest` package ([#14465](https://github.com/jestjs/jest/pull/14453)) -- `[jest-cli]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490)) -- `[jest-types]` [**BREAKING**] Remove deprecated `init` option ([#14490](https://github.com/jestjs/jest/pull/14490)) -- `[jest-config]` Add deprecation notice for the `init` option ([#14490](https://github.com/jestjs/jest/pull/14490)) ## 29.6.4