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

Regression after #12131 #12189

Closed
satanTime opened this issue Dec 25, 2021 · 5 comments
Closed

Regression after #12131 #12189

satanTime opened this issue Dec 25, 2021 · 5 comments

Comments

@satanTime
Copy link

satanTime commented Dec 25, 2021

After the fix of #12131, I'm getting an error: https://app.circleci.com/pipelines/github/ike18t/ng-mocks/2810/workflows/cad5fba3-e1c9-4e59-9d20-daf923c60c31/jobs/101406

    TypeError: Cannot read properties of undefined (reading 'bind')

      at Runtime._createJestObjectFor (node_modules/jest-runtime/build/index.js:2193:46)

is it possible that mocked isn't present in some cases?

Originally posted by @satanTime in #12131 (comment)

@satanTime satanTime changed the title I'm getting an error: https://app.circleci.com/pipelines/github/ike18t/ng-mocks/2810/workflows/cad5fba3-e1c9-4e59-9d20-daf923c60c31/jobs/101406 Regression after #12131 Dec 25, 2021
@satanTime
Copy link
Author

satanTime commented Dec 25, 2021

Hi @SimenB, I found the problem.

it's because of version dependency chains.
In my repo, eventually, it ends up at @jest/environment@27.3.0 which requires jest-mock@27.3.0 which doesn't have .mocked definition.
it was requested by jest-environment-jsdom@27.3.1.

node_modules/jest-* have right version, but some packages with some internal nod_modules have elder versions and this is causes the issue.

Looks like jest-runtime cannot rely on its dependency version for jest-mock only, and, in some cases, it can receive an object which belongs to any version.

@satanTime
Copy link
Author

The issue has been solved by npm update --depth 999 jest-environment-jsdom.

@peterlundberg
Copy link

Or as suggested here #12200 (comment) can probably get it to work with an explicit "jest-environment-jsdom": "^27.4.4" dev dependency (worked for us)

@SimenB
Copy link
Member

SimenB commented Jan 4, 2022

@github-actions
Copy link

github-actions bot commented Feb 4, 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.

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

No branches or pull requests

3 participants