Skip to content

bug(material/tabs): Reference error at unit tests with rc-version #25918

Closed
@Ulse81

Description

@Ulse81

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

14.2.0

Description

We switched to the newest release candidate of angular and angular material. Since then we get the following error when we start our unit tests which use (and import) the MatTabsModule:

ReferenceError: Cannot access '_MatTabNavBase' before initialization

      1 | import { CommonModule } from '@angular/common';
      2 | import { NgModule } from '@angular/core';
    > 3 | import { MatTabsModule } from '@angular/material/tabs';
        | ^
      4 | import { RouterModule } from '@angular/router';
      5 | import { DacklConfigModule } from '../config/config.module';
      6 | import { DacklIconModule } from './../icon/icon.module';

      at Object.<anonymous> (../../node_modules/@angular/material/fesm2015/tabs.mjs:1871:147)
      at Object.<anonymous> (../../libs/ngx-dackl/src/lib/tabs/tabs.module.ts:3:1)
      at Object.<anonymous> (../../libs/ngx-dackl/src/index.ts:77:1)
      at Object.<anonymous> (src/app/app.component.spec.ts:7:1)

Our tabs.module.ts contains the following code:

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MatTabsModule } from '@angular/material/tabs';
import { RouterModule } from '@angular/router';
import { DacklConfigModule } from '../config/config.module';
import { DacklIconModule } from './../icon/icon.module';
import { DacklTabsComponent } from './tabs.component';

@NgModule({
  declarations: [DacklTabsComponent],
  imports: [CommonModule, DacklConfigModule, DacklIconModule, MatTabsModule, RouterModule],
  exports: [MatTabsModule, DacklTabsComponent]
})
export class DacklTabsModule {}

It seems to crash before any test code runs so we are at a loss how to proceed.

Reproduction

Steps to reproduce:

  1. Migrate to Angular and Angular Material release candidates for version 15.
  2. Start the successful tests so far which use and test mat-tabs.

Expected Behavior

The tests that have been successful so far should also succeed using Angular and Material 15.

Actual Behavior

The tests fail with the following error message: ReferenceError: Cannot access '_MatTabNavBase' before initialization

Environment

  • Angular: 15.0.0-rc.1
  • CDK/Material: 15.0.0-rc.0
  • Browser(s): Chrome, Edge
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
  • Nx: 15.0.5
  • Jest: 28.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/tabs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions