angular: Uncaught ReferenceError: beforeEach is not defined

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

Yes

Description

After updated Angular version 15 to 16.2 while application starting testing.mjs throws error.

Uncaught ReferenceError: beforeEach is not defined

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Uncaught ReferenceError: beforeEach is not defined

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 16.2.0
Node: 16.15.0
Package Manager: npm 9.6.7
OS: win32 x64

Angular: 16.2.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, platform-browser-dynamic
... router

Package                         Version
"@angular/animations": "^16.2.0",
    "@angular/cdk": "^16.2.0",
    "@angular/common": "^16.2.0",
    "@angular/compiler": "^16.2.0",
    "@angular/core": "^16.2.0",
    "@angular/forms": "^16.2.0",
    "@angular/localize": "^16.2.0",
    "@angular/platform-browser": "^16.2.0",
    "@angular/platform-browser-dynamic": "^16.2.0",
    "@angular/router": "^16.2.0",
    "@angular/service-worker": "^16.2.0",
    "@babel/core": "^7.22.10",
     *
     *
     *
   "rxjs": "~7.6.0",
    "sass-loader": "10.4.1",
    "shake.js": "^1.2.2",
    "subsink": "^1.0.0",
    "tabulator-tables": "^5.5.0",
    "tempusdominus-bootstrap-4": "^5.39.0",
    "tslib": "^2.6.1",
    "utif": "^3.1.0",
    "uuid": "^8.3.2",
    "validate.js": "^0.13.1",
    "@types/node": "^18.17.0",
    "@types/signalr": "^2.2.35",
    "@typescript-eslint/eslint-plugin": "6.4.0",
    "@typescript-eslint/parser": "6.4.0",
    "cordova-plugin-camera": "^4.0.3",
    "vis-network": "^5.4.1",
    "wnumb": "^1.2.0",
    "xlsx": "^0.17.5",
    "zone.js": "~0.13.1"

  "devDependencies": {
    "@angular-devkit/build-angular": "^16.2.0",
    "@angular-devkit/schematics": "^16.2.0",
    "@angular-eslint/builder": "16.1.0",
    "@angular-eslint/eslint-plugin": "16.1.0",
    "@angular-eslint/eslint-plugin-template": "16.1.0",
    "@angular-eslint/schematics": "16.1.0",
    "@angular-eslint/template-parser": "16.1.0",
    "@angular/cli": "^16.2.0",
    "@angular/compiler-cli": "^16.2.0",
    "@angular/language-service": "^16.2.0",
    "eslint": "^8.47.0",
    "jasmine-core": "^5.1.0",
    "jasmine-spec-reporter": "^7.0.0",
    "karma": "^6.4.2",
    "karma-chrome-launcher": "^3.2.0",
    "karma-coverage-istanbul-reporter": "^3.0.3",
    "karma-jasmine": "^5.1.0",
    "karma-jasmine-html-reporter": "^2.1.0",
    "karma-viewport": "^1.0.9",
    "protractor": "~7.0.0",

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 27 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Using Nx and upgraded from 15 to latest with Angular 16.2.0 yesterday also has this issue when import RouterTestingModule in storybook. Thought it was caused by new version of nx or storybook, but finally figured out this is from angular, fixed by downgrade to 16.1.9.

I had the exact same issue after upgrading from 16.1.7 to 16.2.0, and using RouterTestingModule in Storybook. Fixed it by replacing RouterTestingModule with provideRouter + provideLocationMocks. (PR https://github.com/Energinet-DataHub/greenforce-frontend/pull/1964)

Using Nx and upgraded from 15 to latest with Angular 16.2.0 yesterday also has this issue when import RouterTestingModule in storybook. Thought it was caused by new version of nx or storybook, but finally figured out this is from angular, fixed by downgrade to 16.1.9.