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]: Generics throw error on jit_transform.js #2392

Closed
meriturva opened this issue Apr 23, 2024 · 0 comments · Fixed by #2418
Closed

[Bug]: Generics throw error on jit_transform.js #2392

meriturva opened this issue Apr 23, 2024 · 0 comments · Fixed by #2418
Labels
🐛 Bug Confirmed Bug is confirmed

Comments

@meriturva
Copy link

Version

14.0.3

Steps to reproduce

Just add this line of code to a spec file on example-app-v17 project on your repo:

testTemplate = contentChild.required('test', { read: TemplateRef<unknown> });

this works as aspected:

testTemplate = contentChild.required('test', { read: TemplateRef });

Expected behavior

Support of generics!

Actual behavior

Every time we use generics on our code jest stops to run with the error:


at lD (node_modules/jest-preset-angular/build/transformers/jit_transform.js:33:29237)
          at Array.map (<anonymous>)
      at visitArrayWorker (node_modules/typescript/lib/typescript.js:88241:51)
      at visitNodes2 (node_modules/typescript/lib/typescript.js:88212:21)
      at visitLexicalEnvironment (node_modules/typescript/lib/typescript.js:88268:18)
      at visitEachChildOfSourceFile (node_modules/typescript/lib/typescript.js:89457:13)
      at Object.visitEachChild (node_modules/typescript/lib/typescript.js:88429:35)
      at Object.visitNode (node_modules/typescript/lib/typescript.js:88179:21)
      at transformSourceFileOrBundle (node_modules/typescript/lib/typescript.js:90068:51)
      at transformation (node_modules/typescript/lib/typescript.js:113500:16)
      at transformRoot (node_modules/typescript/lib/typescript.js:113523:73)
      at transformNodes (node_modules/typescript/lib/typescript.js:113508:72)
      at emitJsFileOrBundle (node_modules/typescript/lib/typescript.js:114081:26)
      at emitSourceFileOrBundle (node_modules/typescript/lib/typescript.js:114036:7)
      at forEachEmittedFile (node_modules/typescript/lib/typescript.js:113784:26)
      at emitFiles (node_modules/typescript/lib/typescript.js:114010:5)
      at emitWorker (node_modules/typescript/lib/typescript.js:121515:26)
      at node_modules/typescript/lib/typescript.js:121500:53
      at runWithCancellationToken (node_modules/typescript/lib/typescript.js:121589:16)
      at Object.emit (node_modules/typescript/lib/typescript.js:121500:22)
      at getFileEmitOutput (node_modules/typescript/lib/typescript.js:123900:50)
      at Object.getEmitOutput (node_modules/typescript/lib/typescript.js:144651:14)
      at NgJestCompiler.TsCompiler.getCompiledOutput (node_modules/ts-jest/dist/legacy/compiler/ts-compiler.js:142:48)
      at NgJestTransformer.exports.TsJestTransformer.TsJestTransformer.processWithTs (node_modules/ts-jest/dist/legacy/ts-jest-transformer.js:259:37)
      at NgJestTransformer.exports.TsJestTransformer.TsJestTransformer.process (node_modules/ts-jest/dist/legacy/ts-jest-transformer.js:188:24)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:545:31)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:674:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:726:19)
      at Object.<anonymous> (projects/xxxxx/src/public-api.ts:7:1)
      at Object.<anonymous> (projects/xxxxx/src/lib/services/xxxxxx.spec.ts:3:1)

Additional context

No response

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13650HX
  Binaries:
    Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ~29.7.0 => 29.7.0
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.

2 participants