Reputation: 1
I have an Angular 15.0 project that worked well until I upgraded it to Angular 15.1.
For example this code failed when running unit tests:
@Component({
selector: 'mad-zoom-control',
templateUrl: './zoom-control.component.html',
styleUrls: ['./zoom-control.component.scss']
})
export class ZoomControlComponent extends MadComponent implements OnInit, OnChanges, AfterViewInit {
@Input() conserveRatio = true;
@Input() dropupPredefinedOption = true;
@Input() showPredefined = true;
@Input() showZoomFactor = true;
@Input() zone: Zone = null;
@Output() readonly zoomChanged = new EventEmitter<boolean>();
// Predefined Zoom -> Predefined Zoom Label
static PredefinedZoomEnumMapList = [
['full', MAD_FULL],
['center', MAD_MenuPositionEnum_eCENTER],
['left', MAD_ZoneJustifyXEnum_eLEFT],
['right', MAD_ZoneJustifyXEnum_eRIGHT],
['top', MAD_ZoneJustifyXEnum_eTOP],
['bottom', MAD_ZoneJustifyXEnum_eBOTTOM],
['topLeft', MAD_MenuPositionEnum_eTOP_LEFT],
['topRight', MAD_MenuPositionEnum_eTOP_RIGHT],
['bottomLeft', MAD_MenuPositionEnum_eBOTTOM_LEFT],
['bottomRight', MAD_MenuPositionEnum_eBOTTOM_RIGHT],
];
static PredefinedZoomEnumLabelList = ZoomControlComponent.PredefinedZoomEnumMapList.map((zoneAspect) => zoneAspect[1]);
The issue is:
Chrome 109.0.0.0 (Mac OS 10.15.7) ERROR
An error was thrown in afterAll
Uncaught TypeError: Cannot read properties of undefined (reading 'PredefinedZoomEnumMapList')
TypeError: Cannot read properties of undefined (reading 'PredefinedZoomEnumMapList')
at http://localhost:9876/_karma_webpack_/webpack:/src/app/widgets/zoom-control/zoom-control.component.ts:60:61
at Module.13225 (http://localhost:9876/_karma_webpack_/webpack:/src/app/widgets/zoom-control/zoom-control.component.ts:60:122)
...
I don't see any open issue in Angular or Angular CLI Github repos.
Any help is welcome.
I ran yarn test-coverage
and just want no error as usual.
Upvotes: 0
Views: 475
Reputation: 55754
This is a known bug waiting to be fixed. Investigations report that this happens since 15.1.0-rc.0
Upvotes: 0