Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
nickbabcock opened this issue Mar 12, 2022 · 7 comments
Labels

Comments

@nickbabcock
Copy link

nickbabcock commented Mar 12, 2022

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
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Apr 11, 2022
@nickbabcock
Copy link
Author

Can confirm this bug is still present on 28.0.0-alpha.8

@github-actions github-actions bot removed the Stale label Apr 11, 2022
@SimenB
Copy link
Member

SimenB commented Apr 12, 2022

v27 doesn't provide node condition by default, so that's expected (#11924).

v28. one is not expected, tho... Will take a look.

@SimenB
Copy link
Member

SimenB commented Apr 12, 2022

Ah, v28 is #10883. Not sure why it halfway works in v27 but in now breaks here since resolve doesn't find the package: https://github.com/facebook/jest/blob/816789920fe08b2f0245963e91d3a96fe80e1311/packages/jest-resolve/src/defaultResolver.ts#L118

@SimenB SimenB closed this as completed Apr 12, 2022
@SimenB
Copy link
Member

SimenB commented Apr 19, 2022

@nickbabcock
Copy link
Author

I can confirm that v28 alpha 9 works. Thank you 🎉

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants