Questions tagged [jest-preset-angular]

"jest-preset-angular" is a collection of default settings, Jest Serializers and AST Transformers to make Angular (v2+) compatible to be tested by Jest.

41 questions
0
votes
0 answers

Jest for Angular with Pug throws "SyntaxError: Unexpected token '<'" at templateUrl

I'm changing a very large electron+angular+pug project to use Jest instead of Karma+Jasmine. These are my package versions: Node: 15.14.0 "@angular/cli": "11.2.10", "jest": "27.5.1", "jest-canvas-mock": "2.5.2", "jest-preset-angular":…
0
votes
0 answers

Jest error "Component x is not resolved" when computing the templateUrl at build time

I have an Angular 14 application using Jest for unit testing. For some reason not worth mentioning here we need to compute the templateUrl during build time like this: const suff = "v1"; @Component({ ... templateUrl:…
0
votes
1 answer

Can't run unit tests when using type-only imports

Follow up on this solution I've build a library with a component and a directive, which normally causes an import cycle. Component import { Component } from '@angular/core'; @Component({ selector: 'lib-resizable', templateUrl: `
0
votes
0 answers

Jest transformer setup for Angular project with IBM Carbon library

I'm trying to implement IBM Carbon library in angular project. The implementation is working fine. But I want to use Jest testing platform to run unit tests. Problem is that Jest don't like the way how Carbon Icon module is written. By browsing the…
0
votes
0 answers

angular v12 with jest, upgrade to angular v13 breaks test execution

I upgraded my angular cli based Angular app v12 to v13 and all of a sudden deprecated warning which I was getting in v12 reached to the breaking point. when I run my tests I gets the following error. An unhandled exception occurred: NOT SUPPORTED:…
d-man
  • 57,473
  • 85
  • 212
  • 296
0
votes
2 answers

Using Jest with Angular 13 + Clarity

i am currently attempting to upgrade an existing Angular app which uses VMware Clarity. I already managed to upgrade from 8.x to 10.x following the Angular update guidelines. However beyond that the jest configuration breaks, as the newer Clarity…
0
votes
2 answers

Cannot use import statement outside a module with date-fns in Jest after updating to Angular 13

After updating Angular 12 to 13 some of my Jest tests started failing. It's always the same…
undsoft
  • 789
  • 2
  • 12
  • 21
0
votes
1 answer

Could not locate module @app1/shared mapped as... No mapping for self contained modules

I've added few changes to sub-project example-app-v12-monorepo to reflect my situation: Created public_api.ts file as barrel for shared classes in examples/example-app-v12-monorepo/projects/app1/src/app/shared/public_api.ts. Configured…
psmul
  • 141
  • 1
  • 1
  • 13
0
votes
1 answer

testing angular components with jest gives resolveComponentResources

I'm trying to test Angular components with jest via jest-preset-angular it can run the test by karma with ng test, but running the same test by jest gives the error AppComponent › should create the app Component 'AppComponent' is not resolved: …
Sh eldeeb
  • 1,589
  • 3
  • 18
  • 41
0
votes
0 answers

Can't resolve all parameters for ApplicationModule: (?) using Jest

I am trying to run my tests and I get this error while testing nx(mono-repo) angular test using Jest Can't resolve all parameters for ApplicationModule: (?). at syntaxError (../packages/compiler/src/util.ts:100:17) at…
0
votes
1 answer

Testing effects with Jest with Angular 5

I am implementing tests in effects. The test is giving the error: [{"frame": 10, "notification": {"error": [TypeError: Cannot read property 'getDowntimeOfProductShiftGraphic' of undefined], "hasValue": false, "kind": "E", "value":…
1 2
3