During Cypress E2E testing, angular is not running within. Getting following angular error (we did migrate recently to version 18),
The following error originated from your test code, not from Cypress.
The injectable ‘PlatformNavigation’ needs to be compiled using the JIT compiler, but ‘@angular/compiler’ is not available.
The injectable is part of a library that has been partially compiled.
However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.
Ideally, the library is processed using the Angular Linker to become fully AOT compiled.
Alternatively, the JIT compiler should be loaded by bootstrapping using ‘@angular/platform-browser-dynamic’ or ‘@angular/platform-server’,
or manually provide the compiler with ‘import “@angular/compiler”;’ before bootstrapping.
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.
We dynamically generated a new test to display this failure.
node_modules/@angular/core/fesm2022/core.mjs:3489:1
message +=
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',n
;
message +=or manually provide the compiler with 'import >"@angular/compiler";' before bootstrapping.
;
throw new Error(message);
^
}
else {
throw new Error(‘JIT compiler unavailable’);
at getCompilerFacade (webpack://recorder/./node_modules/@angular/core/fesm2022/core.mjs:3489)
at Module.ɵɵngDeclareFactory (webpack://recorder/./node_modules/@angular/core/fesm2022/core.mjs:37979)
at <static_initializer> (webpack://recorder/./node_modules/@angular/common/fesm2022/common.mjs:33:46)
at ./node_modules/@angular/common/fesm2022/common.mjs (webpack://recorder/./node_modules/@angular/common/fesm2022/common.mjs:25)
at webpack_require (webpack://recorder/webpack/bootstrap:19)
at ./node_modules/@angular/common/fesm2022/http.mjs (http://localhost:52444/__cypress/tests?p=cypresse2eloginlogin.cy.js:7530:73)
at webpack_require (webpack://recorder/webpack/bootstrap:19)
at ./node_modules/keycloak-angular/fesm2022/keycloak-angular.mjs (http://localhost:52444/__cypress/tests?p=cypresse2eloginlogin.cy.js:52812:78)
at webpack_require (webpack://recorder/webpack/bootstrap:19)
at eval (webpack://recorder/./cypress/e2e/login/login.cy.js:2)
From previous event:
at Promise.longStackTracesCaptureStackTrace [as _captureStackTrace] (http://localhost:52444/__cypress/runner/cypress_runner.js:3486:19)
at Promise._then (http://localhost:52444/__cypress/runner/cypress_runner.js:1239:17)
at Promise.then (http://localhost:52444/__cypress/runner/cypress_runner.js:1132:17)
at runScriptsFromUrls (http://localhost:52444/__cypress/runner/cypress_runner.js:111747:136)
at Object.runScripts (http://localhost:52444/__cypress/runner/cypress_runner.js:111788:12)
at $Cypress.onSpecWindow (http://localhost:52444/__cypress/runner/cypress_runner.js:41303:67)“`