bug(cdkTable): MatTable: Cannot read property 'nativeElement' of undefined
Reproduction
Unit testing mat-table with jest gives the following error:
`TypeError: Cannot read property 'nativeElement' of undefined
at MatTable.CdkTable (../src/cdk/table/table.ts:442:24)
at new MatTable (table.ts:7:1)
at createClass (../packages/core/src/view/provider.ts:273:14)
at createDirectiveInstance (../packages/core/src/view/provider.ts:142:7)
at createViewNodes (../packages/core/src/view/view.ts:314:28)
at callViewAction (../packages/core/src/view/view.ts:647:7)
at execComponentViewsAction (../packages/core/src/view/view.ts:570:7)
at createViewNodes (../packages/core/src/view/view.ts:342:3)
at createRootView (../packages/core/src/view/view.ts:216:3)
at callWithDebugContext (../packages/core/src/view/services.ts:638:23)
at Object.debugCreateRootView [as createRootView] (../packages/core/src/view/services.ts:119:10)
at ComponentFactory_.Object.<anonymous>.ComponentFactory_.create (../packages/core/src/view/refs.ts:92:27)
at initComponent (../packages/core/testing/src/test_bed.ts:618:28)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:386:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:117:43)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
at Object.onInvoke (../packages/core/src/zone/ng_zone.ts:326:29)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/dist/zone.js:143:47)
at NgZone.Object.<anonymous>.NgZone.run (../packages/core/src/zone/ng_zone.ts:180:50)
at TestBedViewEngine.Object.<anonymous>.TestBedViewEngine.createComponent (../packages/core/testing/src/test_bed.ts:622:56)
at Function.Object.<anonymous>.TestBedViewEngine.createComponent (../packages/core/testing/src/test_bed.ts:245:36)
at src/app/mass-payment/receipts/receipts.component.spec.ts:73:23
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:386:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:117:43)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/dist/zone.js:143:47)
at Object.testBody.length (node_modules/jest-preset-angular/zone-patch/index.js:52:27)`
leading here:

Does anybody have any idea what is causing the issue?
Expected Behavior
To load table component normally
Actual Behavior
cdkTable issue
Environment
- Angular: 10.0.5
- CDK/Material: 10.1.3
- Browser(s): none
- Operating System: macOS
This issue doesn't have enough information for the team to investigate. Please include a reproduction of the issue (preferably via StackBlitz)
(this is a canned response)
Hello, as I have trouble with the same issue, I've created a stackblitz with the original exmaple from the documentation which fails.
https://angular-7nwwok.stackblitz.io
In my application with same package.json I get additional errors like that:

So I can't get at least a minimal example to work
If any more information is needed please let me know
I think I've found the issue: As I've started with an old version of angular-cli there were some old dependencies like core-js etc. I set up a new Angular cli project form scratch, copied my code an now it works.
So it can be closed due to update problems, not by the lib itself
Seems related to: https://github.com/angular/components/issues/9813 Do we have any details on that?
Closing since the original author didn't provide any further details, and it seems like it may just be an environment issue with core-js versions.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.