Skip to content

[Bug]: Unresolved dependency on jest 28 and incorrectly resolved export map on jest 27 #12574

Closed
@nickbabcock

Description

@nickbabcock

Version

27.5.1 and v28.0.0-alpha.7

Steps to reproduce

For jest 27:

  1. Clone https://github.com/nickbabcock/jest-resolve-issue
  2. npm install
  3. npm test

For jest 28 alpha

  1. Clone https://github.com/nickbabcock/jest-resolve-issue
  2. npm install --save-dev jest@next
  3. npm test

Expected behavior

Welcome to Node.js v16.13.1.
Type ".help" for more information.
> const { MyClass } = require("jest-bug")
undefined
> const a = new MyClass();
undefined
> a.greet()
'hello from node'

Actual behavior

On jest 27:

    Expected: "hello from node"
    Received: "hello from browser"

On jest 28:

    Cannot find module 'jest-bug' from 'tests/test.js'

Additional context

Related (but not dupe): #9771

Environment

System:
    OS: Linux 5.16 Pop!_OS 20.04 LTS
    CPU: (18) x64 AMD Ryzen 9 5900X 12-Core Processor
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
  npmPackages:
    jest: ^28.0.0-alpha.7 => 28.0.0-alpha.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions