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

Cannot read property 'createStringLiteral' of undefined when using jest-27 #925

Closed
NicolasTsc opened this issue May 27, 2021 · 14 comments · Fixed by #926
Closed

Cannot read property 'createStringLiteral' of undefined when using jest-27 #925

NicolasTsc opened this issue May 27, 2021 · 14 comments · Fixed by #926
Labels
🐛 Bug Confirmed Bug is confirmed

Comments

@NicolasTsc
Copy link

🐛 Bug Report

Once I updated the package-json versions of jest and ts-jest to 27.0.1 I can`t run dummy tests anymore, because of there error:

Test suite failed to run

    TypeError: Cannot read property 'createStringLiteral' of undefined

      at Object.getCreateStringLiteral (../../node_modules/jest-preset-angular/build/TransformUtils.js:5:12)
      at ../../node_modules/ts-jest/dist/compiler/ts-compiler.js:169:42
          at Array.map (<anonymous>)
      at TsCompiler._makeTransformers (../../node_modules/ts-jest/dist/compiler/ts-compiler.js:168:47)
      at Object.getCustomTransformers (../../node_modules/ts-jest/dist/compiler/ts-compiler.js:219:63)
      at Object.getEmitOutput (../../node_modules/typescript/lib/typescript.js:149946:73)
      at TsCompiler.getCompiledOutput (../../node_modules/ts-jest/dist/compiler/ts-compiler.js:128:48)
      at TsJestCompiler.getCompiledOutput (../../node_modules/ts-jest/dist/compiler/ts-jest-compiler.js:13:39)
      at TsJestTransformer.process (../../node_modules/ts-jest/dist/ts-jest-transformer.js:146:37)

To Reproduce

Steps to reproduce the behavior:
Create example nrwl angular project, upgrade jest to 27.0.1 and run dummy tests

Expected behavior

Tests working

System:
    OS: Windows 10

Npm packages:
    jest: 27.0.1
    jest-preset-angular: 8.4.0
    typescript: 4,2,4
@NicolasTsc NicolasTsc added Bug Report Needs Repo Need a minimium repository to reproduce the problem Needs Triage labels May 27, 2021
@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

you can try out next tag, we will release 9.0.0 soon so you can ignore warnings in next tag and see if next tag works for you.

8.4.0 is not compatible with Jest 27

@ahnpnl ahnpnl added 🐛 Bug Confirmed Bug is confirmed and removed Bug Report Needs Repo Need a minimium repository to reproduce the problem Needs Triage labels May 27, 2021
@aakaul
Copy link

aakaul commented May 27, 2021

i am facing same issue next tag is not working form me

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

have you tried clearing Jest cache?

If you are using nrwl nx, you should wait for them to add support because there are migration needed on their side.

If you are NOT using nrwl nx, you can try clear Jest cache via jest --clearCache. If still not working, please provide a repo.

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

For nrwl nx, see nrwl/nx#5771

@aakaul
Copy link

aakaul commented May 27, 2021

hi i am not using nrwl

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

you should try clearing Jest cache after upgrading to next tag.

@aakaul
Copy link

aakaul commented May 27, 2021

i tried clearing cache

Steps to repo
npm install jest jest-preset-angular @types/jest --save-dev
npm install ts-jest@next => i was facing TypeError: Jest: a transform must export something.
npm install jest-preset-angular@next
jest --clearCache

env:
node v14.15.0
typescript: 4.0.5
jest-preset-angular: 9.0.0-next.14
jest: 27.0.1
ts-jest: 27.0.0-next.12
angular:11.2
OS: OSX 11.2.2

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

hmm i still cannot reproduce your issue @aakaul I would suggest to wait for new release of jest-preset-angular with v9.0.0 before you can use Jest 27

@aakaul
Copy link

aakaul commented May 27, 2021

ok cool. @ahnpnl thanks i will downgrade the packages

@ahnpnl ahnpnl mentioned this issue May 27, 2021
2 tasks
@NicolasTsc
Copy link
Author

Here is a minimal repo @ahnpnl
https://github.com/NicolasTsc/jest-angular

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

@NicolasTsc please wait for jest-preset-angular 9.0.0. 8.4.0 doesn't work with jest 27

@NicolasTsc
Copy link
Author

@ahnpnl okay any estimated date for it yet?

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 27, 2021

Either this week or beginning of next week

@ahnpnl
Copy link
Collaborator

ahnpnl commented May 28, 2021

Please check our CHANGELOG. 9.0.0 is a major version which contains breaking changes so migration is required. Things require migration are mentioned in CHANGELOG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Confirmed Bug is confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants