Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest tests fail after upgrading v12 => v13 (Cannot access 'MatTabLink' before initialization) #7896

Closed
oco2000 opened this issue Nov 26, 2021 · 2 comments

Comments

@oco2000
Copy link

oco2000 commented Nov 26, 2021

Current Behavior

Jest tests fail, all the tests fail with the same error.

Expected Behavior

Jest tests pass

Steps to Reproduce

Upgrade the existing project using standard migration procedure

Failure Logs

? Test suite failed to run
    ReferenceError: Cannot access 'MatTabLink' before initialization
      1 | import { NgModule } from '@angular/core';
    > 2 | import { MatTabsModule } from '@angular/material/tabs';
        | ^
      3 |
      4 | @NgModule({
      5 |   imports: [MatTabsModule],
      at Object.<anonymous> (../../../../../../../../build/node_modules/@angular/material/fesm2015/tabs.mjs:1621:581)
      at Object.<anonymous> (../../../shared/ui-core/src/lib/components/organisms/tab-bar/tab-bar.module.ts:2:1)
      at Object.<anonymous> (../../../shared/ui-core/src/lib/shared-ui-core.module.ts:6:1)
      at Object.<anonymous> (../../../shared/ui-core/src/index.ts:1:1)
      at Object.<anonymous> (src/lib/components/address-proposal/address-proposal-modal/address-proposal-modal.component.ts:2:1)
      at Object.<anonymous> (src/lib/components/address-proposal/address-proposal-modal/address-proposal-modal.component.spec.ts:1:1)
      at TestScheduler.scheduleTests (../../../../../../../../build/node_modules/@jest/core/build/TestScheduler.js:333:13)
      at runJest (../../../../../../../../build/node_modules/@jest/core/build/runJest.js:401:19)
      at _run10000 (../../../../../../../../build/node_modules/@jest/core/build/cli/index.js:320:7)
      at runCLI (../../../../../../../../build/node_modules/@jest/core/build/cli/index.js:173:3)

Environment

  Node : 14.17.0
  OS   : win32 x64
  yarn : 1.22.17

  nx : 13.2.2
  @nrwl/angular : 13.2.2
  @nrwl/cli : 13.2.2
  @nrwl/cypress : 13.2.2
  @nrwl/devkit : 13.2.2
  @nrwl/eslint-plugin-nx : 13.2.2
  @nrwl/express : 13.2.2
  @nrwl/jest : 13.2.2
  @nrwl/linter : 13.2.2
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : 13.2.2
  @nrwl/nx-cloud : undefined
  @nrwl/react : undefined
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.2.2
  @nrwl/web : undefined
  @nrwl/workspace : 13.2.2
  @nrwl/storybook : 13.2.2
  @nrwl/gatsby : undefined
  typescript : 4.4.4
  rxjs : 6.6.6
  ---------------------------------------
  Community plugins:
         @angular/animations: 13.0.0
         @angular/cdk: 13.0.0
         @angular/cli: 13.0.3
         @angular/common: 13.0.0
         @angular/compiler: 13.0.0
         @angular/core: 13.0.0
         @angular/elements: 13.0.0
         @angular/forms: 13.0.0
         @angular/material: 13.0.0
         @angular/platform-browser: 13.0.0
         @angular/platform-browser-dynamic: 13.0.0
         @angular/router: 13.0.0
         @angular/service-worker: 13.0.0
         @ionic/angular: 5.9.1
         @ngneat/reactive-forms: 1.7.5
         @ngneat/transloco: 2.23.5
         @ngrx/component-store: 13.0.1
         @ngrx/effects: 13.0.1
         @ngrx/entity: 13.0.1
         @ngrx/router-store: 13.0.1
         @ngrx/store: 13.0.1
         @angular-builders/custom-webpack: 12.1.3
         @angular-devkit/build-angular: 13.0.3
         @angular/compiler-cli: 13.0.0
         @angular/language-service: 13.0.0
         @ngneat/spectator: 8.3.2
         @ngrx/schematics: 13.0.1
         @ngrx/store-devtools: 13.0.1
         @nxext/stencil: 12.1.2
         @nxtend/capacitor: 11.1.1
         @nxtend/ionic-angular: 11.1.1
         @storybook/angular: 6.4.0-rc.3
         ng-mocks: 12.5.0
         nx-stylelint: 12.3.1
@leosvelperez
Copy link
Member

Thanks for reporting this!

This is an issue with the Angular partial compilation output (see angular/components#23907 (comment)). It has been fixed on Angular v13.0.1 and Angular Material v13.0.1 now contains the fix (see https://github.com/angular/components/releases/tag/13.0.1).

Please update your Angular packages to the latest version to grab the fix and if you still face issues with it, you can raise it in the Angular repo.

I'll close this since it's not an issue with Nx and a fix has already been provided by Angular.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants