Skip to content

bug: Sanity checks run in test environement #23365

Closed
@eweap

Description

@eweap

As I explained in comment on PR ( #23289 ) I have a lot of warnings coming from angular material sanity checks during my unit test runs, what makes the output unreadable.
@jelbourn advised me to open an issue because sanity checks should not run in test environment.

Thanks for your help !

Steps to reproduce:

  1. Fork https://github.com/eweap/angular-material-warn
  2. Run yarn install then run test with yarn nx test ui to run the test for the ui lib (its a nrwl/nx workspace)

Expected Behavior

What behavior were you expecting to see?
No warning should be display during the test run

Actual Behavior

What behavior did you actually see?
A warning is displayed:

console.warn
      Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming

      at MatCommonModule.Object.<anonymous>.MatCommonModule._checkThemeIsPresent (../../../src/material/core/common-behaviors/common-module.ts:144:15)
      at new MatCommonModule (../../../src/material/core/common-behaviors/common-module.ts:81:12)
      at Object.MatCommonModule_Factory [as factory] (../../node_modules/@angular/material/bundles/material-core.umd.js:189:69)
      at R3Injector.Object.<anonymous>.R3Injector.hydrate (../../../packages/core/src/di/r3_injector.ts:416:29)
      at R3Injector.Object.<anonymous>.R3Injector.get (../../../packages/core/src/di/r3_injector.ts:211:23)
      at ../../../packages/core/src/di/r3_injector.ts:247:51
          at Set.forEach (<anonymous>)
      at R3Injector.Object.<anonymous>.R3Injector._resolveInjectorDefTypes (../../../packages/core/src/di/r3_injector.ts:247:27)

Environment

  • Angular: 12.2.1
  • CDK/Material: 12.2.1
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaroundarea: material/core

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions