Skip to content

Commit

Permalink
chore(jest-cli): Deprecation of the --init argument (#14490)
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-stormtrooper committed Sep 19, 2023
1 parent eaa86fb commit 180bc8b
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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: () =>
` 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 @@ -8055,7 +8055,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 @@ -12496,7 +12496,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

0 comments on commit 180bc8b

Please sign in to comment.