print version ending in -dev when running a local Jest clone #7582
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
#7562 (cc @SimenB) used
__dirname.includes('packages/jest-cli')
to determine whether Jest is running from a local clone of the Jest project (as opposed to a regular node_modules installation). We found a cleaner solution than theincludes
there, but this gave me an idea for something else that could use this information: Indicating that Jest is running from a local clone when called with--version
.I often
yarn link
Jest into 10+ projects and probably do not always remember to unlink it afterwards. So if Jest behaves strangely,yarn jest --version
telling me that it might be because I'm unintentionally running the local Jest clone would be nice (and more cross-platform thanrealpath node_modules/jest-cli/
)Test plan
TODO how can we e2e test that it does NOT print
-dev
in a production version of Jest?