-
-
Notifications
You must be signed in to change notification settings - Fork 826
Open
Labels
Bug: ValidatedThis PR or Issue is verified to be a bug within StencilThis PR or Issue is verified to be a bug within StencilHas WorkaroundThis PR or Issue has a work around detailed within it.This PR or Issue has a work around detailed within it.
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Stencil Version
4.7.0
Current Behavior
FAIL src/components/my-component/my-component.spec.ts
● my-component › test error
TypeError: Cannot read properties of undefined (reading '$hostElement$')
27 | @Listen('ChangeValue')
28 | onChangeValue(event: CustomEvent<string>) {
> 29 | this.stateValue = event.detail;
| ^
30 | }
31 |
32 | render() {
at setValue (node_modules/@stencil/core/internal/testing/index.js:541:58)
at MyComponent.set [as stateValue] (node_modules/@stencil/core/internal/testing/index.js:589:6)
at MyComponent.onChangeValue (src/components/my-component/my-component.tsx:29:20)
at p.<anonymous> (node_modules/@stencil/core/internal/testing/index.js:930:65)
at node_modules/@stencil/core/mock-doc/index.cjs:714:34
at Array.forEach (<anonymous>)
at triggerEventListener (node_modules/@stencil/core/mock-doc/index.cjs:712:19)
at dispatchEvent (node_modules/@stencil/core/mock-doc/index.cjs:733:5)
at p.dispatchEvent (node_modules/@stencil/core/mock-doc/index.cjs:3400:16)
at Object.<anonymous> (src/components/my-component/my-component.spec.ts:20:10)
Expected Behavior
get green test passed
System Info
$ npx stencil info
System: node 18.17.1
Platform: windows (10.0.22621)
CPU Model: 12th Gen Intel(R) Core(TM) i7-1265U (12 cpus)
Compiler: C:\Users\[USERNAME]\workspace\banana\node_modules\@stencil\core\compiler\stencil.js
Build: 1706543579
Stencil: 4.12.0
TypeScript: 5.3.3
Rollup: 2.56.3
Parse5: 7.1.2
jQuery: 4.0.0-pre
Terser: 5.27.0Steps to Reproduce
- create proyect
- create state in component
- create Listen in component
- create page in beforeAll
- create test for Listen
- run test
Code Reproduction URL
https://github.com/jjmato/stencil-error-example
Additional Information
No response
Metadata
Metadata
Assignees
Labels
Bug: ValidatedThis PR or Issue is verified to be a bug within StencilThis PR or Issue is verified to be a bug within StencilHas WorkaroundThis PR or Issue has a work around detailed within it.This PR or Issue has a work around detailed within it.