Skip to content

[Bug]: "Runner is not a constructor" when using nested relative path and Yarn #15712

@G-Rath

Description

@G-Rath

Version

30.0.3

Steps to reproduce

  1. Clone https://github.com/G-Rath/jest-runner-bug
  2. Run yarn install
  3. cd into foo/bar/dip
  4. Run npx jest

Alternatively, see the CI: https://github.com/G-Rath/jest-runner-bug/blob/main/.github/workflows/ci.yml & https://github.com/G-Rath/jest-runner-bug/actions/runs/15981985791/job/45078225921

Expected behavior

Jest to be happy

Actual behavior

Jest errors about "Runner is not a constructor"

Additional context

This was found via jest-community/jest-runner-eslint#291 where I've already done some digging, and spoken to @JounQin about - originally we were not sure if this is actually something Jest officially supports, but now that I know it only seems to happen on Yarn and when nested more than two directories I think it's clearly a bug.

The issue seems to lie with jest-resolve and/or unrs-resolver - see this comment for the work I've done so far

Environment

System:
    OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
  Binaries:
    Node: 20.19.0 - ~/.nodenv/versions/20.19.0/bin/node
    Yarn: 1.22.22 - ~/.nodenv/versions/20.19.0/bin/yarn
    npm: 10.8.2 - ~/.nodenv/versions/20.19.0/bin/npm

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions