Skip to content

npm installing jest at a specific version actually installs a different version #3391

@rally25rs

Description

@rally25rs

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Because of the way jest packages are set up, if you:

npm install jest@18.0.0 then it actually installs jest-cli@18.1.0 (or whatever the greatest minor version release is)

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

  • cd into an npm project directory
  • npm install jest@18.0.0 --save
  • observe that package.json is set to depend on `"jest":"18.0.0" (exact version)
  • grep version node_modules/jest/package.json
  • observe output is `"version": "18.0.0"
  • node node_modules/jest/bin/jest.js -v
  • Output is v18.1.0 (WRONG VERSION!)
  • grep version node_modules/jest-cli/package.json
  • observe output is `"version": "18.1.0" (NOT18.0.0!)

What is the expected behavior?

The exact version of jest should be installed.

The problem is that packages/jest/package.json contains carrot versions of jest-cli

  "dependencies": {
    "jest-cli": "^18.0.0"
  },

so when jest@18.0.0 is installed, it also gets the latest ^18.* release of jest-cli installed.
all the package.json files in /packages should be exact-version dependencies when they are tagged.

The same holds true with v19 releases... they contain the dependency "jest-cli@^19.0.2" so if jest 19.7.0 were to be released and someone tries to npm install jest@~19.0.2 then too bad, you get 19.7.0 anyway even though you only wanted 19.0.* releases.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions