Skip to content

Angular Component Test broken by changes in Angular 14.2.0 (tearDownTestingModule) #23585

Closed
@aki-kesulahti

Description

@aki-kesulahti

Current behavior

Running Angular component tests fails:

2022-08-29 08:24:14: webpack compiled in 29272 ms (23942f0303cba40d)

  ExampleComponent
    1) "before each" hook for "mounts"

  0 passing (183ms)
  1 failing

  1) ExampleComponent
       "before each" hook for "mounts":
     TypeError: _angular_core_testing__WEBPACK_IMPORTED_MODULE_3__.TestBed.tearDownTestingModule is not a function

Because this error occurred during a `before each` hook we are skipping all of the remaining tests.
      at http://localhost:8080/__cypress/src/cypress_support_component_ts.js:645:62
      at $Cypress.<anonymous> (http://localhost:8080/__cypress/src/cypress_support_component_ts.js:433:73)
      at ../driver/node_modules/eventemitter2/lib/eventemitter2.js.EventEmitter.emit (http://localhost:8080/__cypress/runner/cypress_runner.js:99774:22)
      at parent.<computed> [as emit] (http://localhost:8080/__cypress/runner/cypress_runner.js:17[111](https://github.com/xxxxx/runs/8066523883?check_suite_focus=true#step:5:112)2:31)
      at $Cypress.action (http://localhost:8080/__cypress/runner/cypress_runner.js:163775:14)
      at fire (http://localhost:8080/__cypress/runner/cypress_runner.js:173427:18)
      at http://localhost:8080/__cypress/runner/cypress_runner.js:174835:13
      at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:[113](https://github.com/xxxxx/runs/8066523883?check_suite_focus=true#step:5:114)18:23)
      at Promise.attempt.Promise.try (http://localhost:8080/__cypress/runner/cypress_runner.js:8592:29)
      at Object.onRunnableRun (http://localhost:8080/__cypress/runner/cypress_runner.js:174828:67)

Angular (latest) version 14.2.0 version changed something in that part of their code:
https://github.com/angular/angular/blob/main/CHANGELOG.md#1420-2022-08-25
core - fix align TestBed interfaces and implementation (#46635)
angular/angular@7968402
angular/angular#46635
The change affected the public API surface, but in practice those types were already exposed via the TestBedStatic interface, so those APIs were already public.

I think Cypress Angular Component Tests needs to update how they use that mentioned API.

Desired behavior

No response

Test code to reproduce

Update Angular to (latest) version 14.2.0 to reproduce.

Cypress Version

v10.6.0

Node version

v16.16.0

Operating System

Windows 10.0.19043 Build 19043

Debug Logs

No response

Other

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions