Skip to content

bug: @Watch decorator not triggered on inherited classes in unit test environment (Stencil 4.37.x) #6399

@stout-ni

Description

@stout-ni

Prerequisites

Stencil Version

4.37.x

Current Behavior

The @Watch methods defined in the base class are not triggered in the subclass when running unit tests.

After upgrading to Stencil.js 4.37.x, I found an issue with the unit test environment when using class inheritance.
If a component extends a base class that defines @Watch methods, those watchers do not get triggered in the subclass during unit tests.

However, this problem only occurs in the test runner. In an actual browser environment, the inherited @Watch methods work as expected.

Expected Behavior

Inherited @Watch methods should be triggered in the unit test environment the same way they do in the browser.

System Info

System: node 20.15.1
Platform: darwin (24.6.0)
CPU Model: Apple M3 Pro (12 cpus)
Compiler: /Users/bytedance/Desktop/stencil-rue1b2al/node_modules/.pnpm/@stencil+core@4.37.1/node_modules/@stencil/core/compiler/stencil.js
Build: 1758315275
Stencil: 4.37.1 🏰
TypeScript: 5.5.4
Rollup: 4.34.9
Parse5: 7.2.1
jQuery: 4.0.0-pre
Terser: 5.37.0

Steps to Reproduce

  1. Fork the reproduction repository
  2. Run npm install
  3. Run npm run test

Code Reproduction URL

https://github.com/stout-ni/stencil-rue1b2al

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions