Skip to content

Add Support For Mocking New viewChild Function (Fix (reading 'Symbol(SIGNAL)') error)#12875

Merged
satanTime merged 2 commits into
help-me-mom:masterfrom
Watercycle:feature/angular-19-view-child-support
Feb 3, 2026
Merged

Add Support For Mocking New viewChild Function (Fix (reading 'Symbol(SIGNAL)') error)#12875
satanTime merged 2 commits into
help-me-mom:masterfrom
Watercycle:feature/angular-19-view-child-support

Conversation

@Watercycle
Copy link
Copy Markdown
Contributor

@Watercycle Watercycle commented Jan 30, 2026

Summary

Fixes #8634

As a follow-up to #11909, this PR duplicates #8771, which improves Angular 19 compatibility by hiding viewChild and friends from the mock component metadata. The original PR seems to have gotten stuck in CI purgatory. Full credits to c-harding - this solution seems to work as expected so I'm just offering to shepherd it through CI.

Testing

  1. Validated that the original test fails without this change.
  2. Published it to here.
  3. Added it to package.json as:
"ng-mocks": "https://github.com/Watercycle/ng-mocks/releases/download/v14.16.0/ng-mocks-0.0.0.tgz"
  1. Ran npm install.
  2. Saw it work on a large Angular project where the latest ng-mocks does not.

@Watercycle Watercycle changed the title feat: Remove ViewChild from metadata feat: Add Support For Mocking New viewChild Function (Fix (reading 'Symbol(SIGNAL)') error) Jan 30, 2026
@Watercycle Watercycle changed the title feat: Add Support For Mocking New viewChild Function (Fix (reading 'Symbol(SIGNAL)') error) Add Support For Mocking New viewChild Function (Fix (reading 'Symbol(SIGNAL)') error) Jan 30, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2df36be) to head (bfadde7).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #12875   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          228       228           
  Lines         4988      4987    -1     
  Branches      1158      1159    +1     
=========================================
- Hits          4988      4987    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Watercycle Watercycle marked this pull request as ready for review January 30, 2026 23:31
@Watercycle Watercycle requested a review from satanTime as a code owner January 30, 2026 23:31
@Watercycle Watercycle marked this pull request as draft January 31, 2026 00:22
@Watercycle
Copy link
Copy Markdown
Contributor Author

I'm getting a similar error to before on my "0.0.3" patch that wasn't happening on "0.0.1". Taking a closer look.

Error: NG0303: Can't bind to 'abc' since it isn't a known property of 'xyz'

Watercycle and others added 2 commits January 30, 2026 18:27
ViewChild will always be null, and so there is no point in mocking it.
viewChild.required throws an error in mocked components without this
change.

Fixes help-me-momGH-8634

Co-Authored-By: c-harding <c-harding@users.noreply.github.com>
@Watercycle Watercycle force-pushed the feature/angular-19-view-child-support branch from 21e783c to bfadde7 Compare January 31, 2026 00:30
@bobbyg603
Copy link
Copy Markdown

@Watercycle I plopped 0.03 into our app moments ago, and it works like a champ - thanks!

@Watercycle
Copy link
Copy Markdown
Contributor Author

Ah, I failed to update my fork's master branch several times. Created a new v14.16.0/ng-mocks-0.0.0.tgz test release that's fully working as expected now. All good to go!

@Watercycle Watercycle marked this pull request as ready for review January 31, 2026 00:44
@satanTime satanTime merged commit d47c0b6 into help-me-mom:master Feb 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Incompatibility of MockComponent with new viewChild signal function

3 participants