keycloak-angular icon indicating copy to clipboard operation
keycloak-angular copied to clipboard

Running Jest fails with "TypeError: e.observe is not a function"

Open berkon opened this issue 1 year ago • 0 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search for issues before submitting
- [ ] feature request

I'm trying to run jest with keycloak-angular. There are no test cases there yet. When running npm test initially I got this error:

SyntaxError: Cannot use import statement outside a module

after adding keycloak-angular to the regex of the transformIgnorePatterns property of jest.config.ts ("adding" here in fact means removing it! Really strange logic!) the error turned into this:

TypeError: e.observe is not a function

Versions.

[email protected] [email protected] [email protected]

Repro steps.

The log given by the failure.

Test suite failed to run

TypeError: e.observe is not a function

> 30 | import { KeycloakService } from 'keycloak-angular';
       ^
at s (node_modules/keycloak-js/dist/keycloak.js:20:416)
at node_modules/keycloak-js/dist/keycloak.js:20:4471
at node_modules/keycloak-js/dist/keycloak.js:20:33
at node_modules/keycloak-js/dist/keycloak.js:20:38
at node_modules/keycloak-js/dist/keycloak.js:21:4
at node_modules/keycloak-js/dist/keycloak.js:2:82
at Object.<anonymous> (node_modules/keycloak-js/dist/keycloak.js:5:3)
at Object.<anonymous> (node_modules/keycloak-angular/fesm2022/keycloak-angular.mjs:6:22)
at Object.<anonymous> (src/app/header/header.component.ts:30:1)
at Object.<anonymous> (src/app/navigation/left-side-menu/left-side-menu.component.ts:26:1)
at Object.<anonymous> (src/app/navigation/left-side-menu/left-side-menu.component.spec.ts:3:1)

Desired functionality.

Running jest should not fail because of e.observe

berkon avatar Oct 20 '24 11:10 berkon