| Nov |
DEC |
Jan |
|
29 |
|
| 2024 |
2025 |
2026 |
About this capture
The Wayback Machine - http://web.archive.org/web/20251229090737/https://github.com/angular/angular-cli/issues/10482
Skip to content
Navigation Menu
Appearance settings
AI CODE CREATION
GitHub CopilotWrite better code with AI
GitHub SparkBuild and deploy intelligent apps
GitHub ModelsManage and compare prompts
MCP RegistryNewIntegrate external tools
DEVELOPER WORKFLOWS
ActionsAutomate any workflow
CodespacesInstant dev environments
IssuesPlan and track work
Code ReviewManage code changes
APPLICATION SECURITY
GitHub Advanced SecurityFind and fix vulnerabilities
Code securitySecure your code as you build
Secret protectionStop leaks before they start
EXPLORE
●Why GitHub
●Documentation
●Blog
●Changelog
●Marketplace
View all features
BY COMPANY SIZE
●Enterprises
●Small and medium teams
●Startups
●Nonprofits
BY USE CASE
●App Modernization
●DevSecOps
●DevOps
●CI/CD
●View all use cases
BY INDUSTRY
●Healthcare
●Financial services
●Manufacturing
●Government
●View all industries
View all solutions
EXPLORE BY TOPIC
●AI
●Software Development
●DevOps
●Security
●View all topics
EXPLORE BY TYPE
●Customer stories
●Events & webinars
●Ebooks & reports
●Business insights
●GitHub Skills
SUPPORT & SERVICES
●Documentation
●Customer support
●Community forum
●Trust center
●Partners
COMMUNITY
GitHub SponsorsFund open source developers
PROGRAMS
●Security Lab
●Maintainer Community
●Accelerator
●Archive Program
REPOSITORIES
●Topics
●Trending
●Collections
ENTERPRISE SOLUTIONS
Enterprise platformAI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced SecurityEnterprise-grade security features
Copilot for BusinessEnterprise-grade AI features
Premium SupportEnterprise-grade 24/7 support
●Pricing
Search or jump to...
Clear
Search syntax tips
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
To see all available qualifiers, see our documentation.
Appearance settings
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
{{ message }}
angular
/
angular-cli
Public
●
Notifications
You must be signed in to change notification settings
●
Fork
11.9k
Star
27k
●
Code
●
Issues
264
●
Pull requests
28
●
Actions
●
Security
Uh oh!
There was an error while loading. Please reload this page.
●
Insights
Additional navigation options
●
Code
●
Issues
●
Pull requests
●
Actions
●
Security
●
Insights
New issue
Copy link
New issue
Copy link
Enhancement
Copy link
Labels
area: @schematics/angularfeatureIssue that requests a new featureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsLabel to add when the not a sufficient number of votes or comments from unique authors
Milestone
needsTriage
Description
michaelbromley
opened onApr 27, 2018
Issue body actions
Versions
Angular CLI: 1.7.3
Node: 8.9.1
OS: win32 x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.4.2
webpack: 3.11.0
Repro steps
●ng generate component test -cd OnPush
●Edit the test.component.html to be
{{ checkMe() }}
●Add the checkMe method to test.component.ts:
checkMe() {
console.log('change detection was invoked!');
}
●Edit the generated .spec file to include the following test:
{
fixture.detectChanges();
fixture.detectChanges();
fixture.detectChanges();
});">fit('runs change detection', () => {
fixture.detectChanges();
fixture.detectChanges();
fixture.detectChanges();
});
●Run unit test
Observed behavior
'change detection was invoked!' is logged only once (the initial check on creation of the component) rather than 4 times. That is to say, invoking fixture.detectChanges() does not actually run change detection. This is a known issue and is discussed in angular/angular#12313
LOG: 'change detection was invoked!'
Chrome 65.0.3325 (Windows 10 0.0.0): Executed 1 of 478 SUCCESS (0 secs / 0.138 secs)
Desired behavior
As discussed in the thread linked above, the solution for testing OnPush components is to use the "test host component" pattern as described in the angular.io testing docs.
Therefore, the Angular CLI should use a schematic which uses the test host component when the -cd OnPush flag has been used. Otherwise we get a default test setup which is not fit for purpose (and will cause many wasted hours for devs like me ð)
aszechlicki, JesseZomer, prabh-62, szku01 and visz01
No one assigned
area: @schematics/angularfeatureIssue that requests a new featureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsLabel to add when the not a sufficient number of votes or comments from unique authors
Enhancement
No projects
needsTriageNo due date
None yet
No branches or pull requests
Issue actions
Footer
© 2025 GitHub, Inc.
●
Terms
●
Privacy
●
Security
●
Status
●
Community
●
Docs
●
Contact
●
●
ation
You canât perform that action at this time.