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.

[Question] Compatibility with jest-preset-angular

See original GitHub issue

Has anyone used this library in a monorepo project with the jest-preset-angular preset, which configures ts-jest in a way that conflicts with this library.

I tried this which doesn’t work (nameof is detected, but then the preset fails and so the tests don’t run):

  globals: {
    "ts-jest": {
      tsConfig: '<rootDir>/tsconfig.spec.json',
      stringifyContentPathRegex: '\\.html$',
      astTransformers: [
        "ts-nameof",
        require.resolve("jest-preset-angular/InlineHtmlStripStylesTransformer"),
      ],
    }
  },

In fact is it even possible to use multiple presets or transformers?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dsherretcommented, Apr 8, 2019

The compiler never listens to my prayers either 😞

No, it’s fine—keep it open. I’ll look into it eventually.

Also, opened #52.

0reactions
lonix1commented, Apr 2, 2019

I tried many things, like:

  • changing the order of the transformers
  • using require.resolve
  • using clone and merge routines to merge configs together (idea from the preset repo linked above)
  • swear at, cajole with and pray to the compiler

In all cases the jest-angular stuffs works, but nameof fails. But if I use nameof alone it works brilliantly.

I think you’re right it’s a problem with ts-jest. Please don’t do anything about this as because you don’t use angular, so I don’t want you to waste your time. I see there are quite a few angular users besides me, so hopefully one of them will join this issue with some ideas!

Should I go ahead and close?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ivy compatibility · Issue #409 · thymikee/jest-preset-angular
Hi @JiaLiPassion, I know that you work on zone.js but I wonder if you are also familiar with Angular compiler area ? We...
Read more >
Angular >=13 | jest-preset-angular - GitHub Pages
jest -preset-angular currently supports testing with Jest in CommonJS mode with Angular 13 using default preset. With Jest 28 and jest-preset-angular v12. 0.0, ......
Read more >
jest-preset-angular - npm
ngcc-jest-processor will compile any Angular format packages to umd format which is compatible with CommonJS that Jest is using.
Read more >
Newest 'jest-preset-angular' Questions - Stack Overflow
"jest-preset-angular" is a collection of default settings, Jest Serializers and AST Transformers to make Angular (v2+) compatible to be tested by Jest. Learn ......
Read more >
Testing Angular 2 and Continuous Integration with Jest
Next, add a file setup-jest.ts to the src directory: import 'jest-preset-angular';.
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