You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v8.x
Current Behavior
When running unit tests with any Angular-component that has an ion-item in its template, I am seeing TypeError: Cannot read properties of undefined (reading '$instanceValues$').
The issue only occurs if the currently newest version of @stencil/core (v4.23.2) is installed. That version is only possible to install with Ionic Angular v8.2.9 or lower, because this PR (released in v8.3.0) pins the stencil dependency to v4.20.0 for unrelated reasons.
The issue therefore currently surfaces for version v8.2.9 and below, and I suspect this issue will re-surface in a future version once the version pinning is relaxed again.
Expected Behavior
I expect no errors to be thrown by the component under test.
Replace the app component template contents with <ion-item></ion-item>.
Edit the spec file to run multiple tests, e.g. repeat expect(app).toBeTruthy(); 5-10 times.
a. Important: I can only reproduce the error when a test suite contains multiple tests running after each other.
run npm run test and see test succeeding, but often multiple TypeError: Cannot read properties of undefined (reading '$instanceValues$') will be thrown.
If no errors are observed, try re-running the tests.
RasmusKjeldgaard
changed the title
bug: $instanceValue$ undefined in unit tests
bug: $instanceValue$ undefined in unit tests with ion-item
Jan 16, 2025
Prerequisites
Ionic Framework Version
v8.x
Current Behavior
When running unit tests with any Angular-component that has an
ion-item
in its template, I am seeingTypeError: Cannot read properties of undefined (reading '$instanceValues$')
.The issue only occurs if the currently newest version of
@stencil/core
(v4.23.2) is installed. That version is only possible to install with Ionic Angular v8.2.9 or lower, because this PR (released in v8.3.0) pins the stencil dependency to v4.20.0 for unrelated reasons.The issue therefore currently surfaces for version v8.2.9 and below, and I suspect this issue will re-surface in a future version once the version pinning is relaxed again.
Expected Behavior
I expect no errors to be thrown by the component under test.
Steps to Reproduce
Following steps was reproduced here: https://github.com/RasmusKjeldgaard/item-instance-value-repro
@ionic/[email protected]
and@stencil/[email protected]
<ion-item></ion-item>
.expect(app).toBeTruthy();
5-10 times.a. Important: I can only reproduce the error when a test suite contains multiple tests running after each other.
npm run test
and see test succeeding, but often multipleTypeError: Cannot read properties of undefined (reading '$instanceValues$')
will be thrown.Code Reproduction URL
https://github.com/RasmusKjeldgaard/item-instance-value-repro
Ionic Info
Ionic:
Ionic CLI : 7.2.0
Ionic Framework : @ionic/angular 8.2.7
@angular-devkit/build-angular : 18.2.12
@angular-devkit/schematics : 18.2.12
@angular/cli : 18.2.12
@ionic/angular-toolkit : 12.1.1
Additional Information
No response
The text was updated successfully, but these errors were encountered: