question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installing jest@25.4.0 installs incorrect v25.5.4 @jest/core dependency

See original GitHub issue

💥 Regression Report

I have a repo with Jest v25.4.0 installed, and all tests are passing. If I clone that repo at a new location, npm install, and run my tests, one of my suites fails. I ran npx jest --version in both locations, and was surprised that the output versions were different: v25.4.0 in the original clone, and v25.5.4 in the new clone. For what it is worth, jest is not installed globally.

I deleted node_modules directory and package-lock.json from the new clone, removed jest from package.json dependencies, ran npm install, followed by npm install -D jest@25.4.0 to ensure that version 25.4.0 was installed. npx jest --version still output v25.5.4. I then checked node_modules/jest/package.json and it contains the correct version number 25.4.0. However, node_modules/@jest/core/package.json shows a version number of 25.5.4.

I repeated the above process with versions 25.3.0 and 25.2.0, with the exact same outcome: failing tests and incorrect version of @jest/core. I’m not sure when the regression was introduced, or what changes are making my tests fail, but I do know that everything was working properly when 25.4.0 was the latest release.

As an aside, this:

npm i -D jest@24.0.0
npx jest --version

outputs: 24.9.0, so the issue may have been around for awhile.

Last working version

Worked up to version: 25.4.0

Stopped working in version: unknown

To Reproduce

npm init -y
npm install -D jest@25.4.0
npx jest --version

Expected behavior

I expected jest v25.4.0 to be installed

Link to repl or repo (highly encouraged)

Repl.it will not allow the install of previous package versions.

Run npx envinfo --preset jest

$ npx envinfo --preset jest
npx: installed 1 in 0.649s

  System:
    OS: Linux 5.6 Fedora 31 (Workstation Edition) 31 (Workstation Edition)
    CPU: (4) x64 Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
  Binaries:
    Node: 14.1.0 - /usr/bin/node
    npm: 6.14.4 - /usr/bin/npm
  npmPackages:
    jest: 25.4.0 => 25.4.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
chet-manleycommented, May 2, 2020

I feel that the issue with using ranges is that, if you push a bug to a package that is depended on, it breaks every prior version in the semver major range of the main package with no recourse. It also means you can only ever install the latest version from each semver major range. It doesn’t seem unrealistic for an end-user to expect npm install package@x.y.z to install version “x.y.z” exactly (and Jest even appears to do so, as the installed node_modules/jest version is correct).

Since I cannot install version 25.4.0 anymore, I’m going to have to either figure out what is causing Jest to fail, or downgrade to the latest version of the 24 branch. I am fairly certain it has something to do with the new work on ESM, but I don’t really have the time to dig through the latest changes to Jest at the moment.

0reactions
github-actions[bot]commented, May 5, 2022

This issue 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found