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

Conversation

dj-stormtrooper
Copy link
Contributor

@dj-stormtrooper dj-stormtrooper commented Sep 7, 2023

Summary

As discussed here I prepared a PR for Jest 30 with the deprecation of the --init flag

Test plan

I checked that:

  • jest prints deprecation error with corresponding message
  • build doesn't contain any related code
image

@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 17abf40
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/65095c67c972070008662c20
😎 Deploy Preview https://deploy-preview-14490--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dj-stormtrooper
Copy link
Contributor Author

@SimenB could you please add it to the Jest 30 Milestone?

@dj-stormtrooper dj-stormtrooper changed the title chore(jest-cli): Deprecation of --initargument chore(jest-cli): Deprecation of --init argument Sep 7, 2023
@dj-stormtrooper dj-stormtrooper changed the title chore(jest-cli): Deprecation of --init argument chore(jest-cli): Deprecation of the --init argument Sep 7, 2023
@mrazauskas mrazauskas added this to the Jest 30 milestone Sep 7, 2023
Copy link
Contributor

@mrazauskas mrazauskas left a comment

Choose a reason for hiding this comment

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

Thanks!

@SimenB
Copy link
Member

SimenB commented Sep 7, 2023

We should handle people passing it and direct them to the new command. Currently AFK, but grep-ing for deprecated or some such should turn up some results.

@SimenB
Copy link
Member

SimenB commented Sep 7, 2023

Around here:

if (deprecatedOptions.length) {
logDeprecatedOptions(deprecatedOptions, CLIDeprecations, argv);
}

So possibly just adding to https://github.com/jestjs/jest/blob/0b0cf73a9fd5d6ad6cbf0152da0caed3658874b7/packages/jest-config/src/Deprecated.ts

@dj-stormtrooper
Copy link
Contributor Author

So possibly just adding to https://github.com/jestjs/jest/blob/0b0cf73a9fd5d6ad6cbf0152da0caed3658874b7/packages/jest-config/src/Deprecated.ts

Thanks @SimenB, I'm already trying that, the only thing that is left is that we need to keep that in allowedOptions in order to make this message printed, because unrecognizedOptions check runs before the deprecation check
https://github.com/jestjs/jest/blob/main/packages/jest-validate/src/validateCLIOptions.ts#L86

Another thought is that we probably need to exit early, because this deprecation message is only a warning, and it will try to run jest after validation:

image

@dj-stormtrooper
Copy link
Contributor Author

I'd suggest to update validateCLIOptions function to run deprecation warnings before other checks

It will make deprecation logic more flexible, otherwise we need to keep unnecessary code for a while

@SimenB
Copy link
Member

SimenB commented Sep 7, 2023

I'd suggest to update validateCLIOptions function to run deprecation warnings before other checks

It will make deprecation logic more flexible, otherwise we need to keep unnecessary code for a while

That makes sense to me 👍 Wanna send a separate PR for that? Should be landable in 29

@dj-stormtrooper
Copy link
Contributor Author

That makes sense to me 👍 Wanna send a separate PR for that? Should be landable in 29

Sounds good

@SimenB SimenB enabled auto-merge (squash) September 19, 2023 08:31
@SimenB SimenB merged commit 180bc8b into jestjs:main Sep 19, 2023
60 of 66 checks passed
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2023
@SimenB
Copy link
Member

SimenB commented Oct 30, 2023

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants