question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Cannot read property 'createdNodeArray' from hoist-jest.js

See original GitHub issue

Version

28.0.4

Steps to reproduce

jest

Expected behavior

Test should pass

Actual behavior

error message pointing to ts-jest transformer

Debug log

FAIL src/react-app/tests/components/test-component/index.test.tsx ● Test suite failed to run

TypeError: Cannot read property 'createNodeArray' of undefined

  at visitor (node_modules/ts-jest/dist/transformers/hoist-jest.js:84:61)
  at Object.visitNode (node_modules/typescript/lib/typescript.js:72988:23)
  at node_modules/ts-jest/dist/transformers/hoist-jest.js:96:23
  at transformSourceFileOrBundle (node_modules/typescript/lib/typescript.js:74582:57)
  at transformation (node_modules/typescript/lib/typescript.js:91960:24)
  at transformRoot (node_modules/typescript/lib/typescript.js:91981:82)
  at Object.map (node_modules/typescript/lib/typescript.js:551:29)
  at Object.transformNodes (node_modules/typescript/lib/typescript.js:91967:30)
  at emitJsFileOrBundle (node_modules/typescript/lib/typescript.js:92505:32)
  at emitSourceFileOrBundle (node_modules/typescript/lib/typescript.js:92457:13)

Additional context

jest v28.1.1 ts-jest v28.0.4

Environment

System:
  OS: Windows 11 Pro
Binaries:
  Node: 14.17.6
  Yarn: 1.22.11
  npm: 6.14.15
npmPackages:
  jest: 28.1.1
  ts-jest: 28.0.4

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
ahnpnlcommented, Jul 8, 2022

Jest 28 requires TypeScript 4.3, you should downgrade to Jest 27. You can check Jest CHANGELOG here https://github.com/facebook/jest/blob/main/CHANGELOG.md#chore--maintenance-6 as they mention it’s a breaking change.

0reactions
ivanblinov2k17commented, Jul 8, 2022

Hello @ahnpnl , i get the same issue while using TS 3.8 with ts-jest 28.0.5 and jest 28.1.2 Unfortunately due to some issues i can’t quickly update TS to 4.3 and i need to use jest 28 (for monorepo style jest+ babel config) Workaround you have provided seems not working for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: TypeError: Cannot read property 'createNodeArray' of ...
Version. 28.1.0. Steps to reproduce. Not able to share the code. Expected behavior. Runs Test cases under Test suite. Actual behavior.
Read more >
Common errors - FAQ - A progressive Node.js framework
During your development with NestJS, you may encounter various errors as you learn the framework. "Cannot resolve dependency" error#. Probably the most common ......
Read more >
NestJS : TypeError: Cannot read property 'get' of undefined
Your MongoService needs to be marked with @Injectable() so that Nest can read the metadata of the constructor and set up the injection...
Read more >
cannot read properties of undefined (reading 'type') nestjs
I am getting the following error as mentioned above. I am not able to understand where the problem is. Open side panel.
Read more >
Getting started with continuous integration for Nest.js APIs
Learn how to build RESTful APIs with Nest.js, a Node.js framework built with TypeScript, and automate testing using CircleCI.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found