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]: TypeError: Cannot read properties of undefined (reading 'bind') #12200

Closed
linaGirl opened this issue Dec 30, 2021 · 3 comments · Fixed by #12213
Closed

[Bug]: TypeError: Cannot read properties of undefined (reading 'bind') #12200

linaGirl opened this issue Dec 30, 2021 · 3 comments · Fixed by #12213

Comments

@linaGirl
Copy link

linaGirl commented Dec 30, 2021

Version

27.4.5

Steps to reproduce

  1. clone repo https://github.com/rainbow-industries/jest-bug
  2. npm i
  3. npm test
  4. experience the bug
npm test

> jest-bug@1.0.0 test
> jest --config=jest.config.js

 FAIL  ./demo.test.js
  ● Test suite failed to run

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

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

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.372 s
Ran all test suites

Expected behavior

I expect the test not to fail since it just contains one console.log statement.

Actual behavior

The test fails with an error that looks very similar to this regression:
#12189 (comment)

Additional context

I'd like to run test without transformations with ES Modules. That's the reason i use jest-environment-jsdom-sixteen as testEnvironment in the config.

Environment

System:
  OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
  CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
Binaries:
  Node: 16.13.1 - /usr/bin/node
  npm: 8.1.2 - /usr/bin/npm
npmPackages:
  jest: ^27.4.5 => 27.4.5
@rexebin
Copy link

rexebin commented Jan 3, 2022

I have this exact error with jest 27.4.5. Add "jest-environment-jsdom": "^27.4.4" fix it. Reversing jest to 26 also fix it.

@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
jonathonherbert added a commit to guardian/prosemirror-elements that referenced this issue May 13, 2022
jonathonherbert added a commit to guardian/prosemirror-elements that referenced this issue May 17, 2022
jonathonherbert added a commit to guardian/prosemirror-elements that referenced this issue Oct 11, 2022
…ield` type (#248)

BREAKING CHANGE: * Add repeater node to nodeSpec

* Add test to verify NodeSpec creation

* Amend runtime and types to pass test

* Move nodeSpec tests to nodeSpec test file

* Better hierarchy/descriptions in element.spec.ts

* Implement node creation from field values for repeater fields

* Add handler for repeater fields in getFieldValueFromNode

* Add repeater field to demo element for testing; begin amending nodeSpec for correct ser/de

* Correct toDOM signature, and extend tests to cover nested cases

* Backfill empty repeater fields with an empty array

* Tidy up a few types

* Add test data to demo element for inspection

* Provide mapping for RepeaterFieldView

* Amend Field signature to include field values and errors, and implement

* Update renderer to account for new Field signature

* Amend elements to account for new signature

* Move element creation to Form to remove the need for manually specifying prop types

* Add errors on field init; use fields stored in component state, not props, when rendering elements

* Bump jest to fix jestjs/jest#12200

* Add node type as default for ease of testing

* Add test

* Rename create and update functions for clarity

* Throw error when create or update functions cannot find field

* Resolve dependency issues
jonathonherbert added a commit to guardian/prosemirror-elements that referenced this issue Oct 19, 2022
* Add repeater node to nodeSpec

* Add test to verify NodeSpec creation

* Amend runtime and types to pass test

* Move nodeSpec tests to nodeSpec test file

* Better hierarchy/descriptions in element.spec.ts

* Implement node creation from field values for repeater fields

* Add handler for repeater fields in getFieldValueFromNode

* Add repeater field to demo element for testing; begin amending nodeSpec for correct ser/de

* Correct toDOM signature, and extend tests to cover nested cases

* Backfill empty repeater fields with an empty array

* Tidy up a few types

* Add test data to demo element for inspection

* Provide mapping for RepeaterFieldView

* Amend Field signature to include field values and errors, and implement

* Update renderer to account for new Field signature

* Amend elements to account for new signature

* Move element creation to Form to remove the need for manually specifying prop types

* Add errors on field init; use fields stored in component state, not props, when rendering elements

* Bump jest to fix jestjs/jest#12200

* Add node type as default for ease of testing

* Add test

* Rename create and update functions for clarity

* Throw error when create or update functions cannot find field

* Add demo repeater element

* Move to new repeater node structure

Still to do -- correctly update nested fields, which are currently not receiving updates when their fields are edited. This is because updateFieldsFromNode has not yet been modified to deal with nested values

* Update nested fields correctly

* Do not update repeater nodes unless they've changed

* Begin work to update offsets in repeaters when fields are updated (but this work is not yet done)

* Apply offsets dynamically

* Expose offset on FieldViews for testing purposes

* Add test and remove redundant code

* Revert "Add demo repeater element"

This reverts commit c81f7dc.

* Remove unused imports

* Add repeater fields to demo image

* Resolve dependency issues

* Bump Cypress to fix slow tests

* Correct test configuration and specs to match new layout
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants