IgniteUI / igniteui-angular

Ignite UI for Angular is a complete library of Angular-native, Material-based Angular UI components with the fastest grids and charts, Pivot Grid, Dock Manager, Hierarchical Grid, and more.
https://www.infragistics.com/products/ignite-ui-angular
Other
572 stars 161 forks source link

Jest tests errors about IgxCarouselComponent being accessed before initialization #15020

Open fexxdev opened 1 week ago

fexxdev commented 1 week ago

Description

The IgxCarouselComponent causes a ReferenceError: Cannot access 'IgxCarouselComponent' before initialization error during testing, even though IgxCarouselComponent is not explicitly imported or used anywhere in the codebase. The error occurs when testing components that use other Ignite UI components, such as IgxSwitchComponent.

Steps to reproduce

  1. Create a component that imports and uses IgxSwitchComponent or other Ignite UI components (e.g., IgxButtonDirective, IgxToggleDirective).
  2. Set up a unit test for this component using @angular/core/testing and @testing-library/angular.
  3. Run the test.

Result

A ReferenceError: Cannot access 'IgxCarouselComponent' before initialization error appears in the test output, even though IgxCarouselComponent is not used directly. The error prevents tests from running successfully.

Expected result

The test should run without attempting to initialize or reference IgxCarouselComponent, as it is not explicitly imported or used in the test or the component code.

Attachments

Here is a sample error message:

ReferenceError: Cannot access ‘IgxCarouselComponent’ before initialization
at Object. (node_modules/@infragistics/igniteui-angular/fesm2022/infragistics-igniteui-angular.mjs:34362:172)
at Object. (src/app/feature-modules/forms/fields/j-custom-selection-field-editor/j-custom-selection-field-editor.component.ts:7:1)
at Object. (src/app/feature-modules/forms/fields/j-custom-selection-field-editor/j-custom-selection-field-editor.component.spec.ts:4:1)

This issue occurs in Angular unit tests for components that include Ignite UI components, even when IgxCarouselComponent is not part of the component or test dependencies.

fexxdev commented 4 days ago

Little update: i've tried to rollback to v18.1.17 and all tests pass. So it's a bug introduced with v18.2