René's URL Explorer Experiment


Title: Dependency injection and class inheritance doesn't work in Angular 8 library test · Issue #31337 · angular/angular · GitHub

Open Graph Title: Dependency injection and class inheritance doesn't work in Angular 8 library test · Issue #31337 · angular/angular

X Title: Dependency injection and class inheritance doesn't work in Angular 8 library test · Issue #31337 · angular/angular

Description: 🐞 bug report Affected Package The issue is caused by package @angular/core@^8 Is this a regression? Yes, the previous version in which this bug was not present was: @angular/core@7 Description The problem occurs when: The base class has ...

Open Graph Description: 🐞 bug report Affected Package The issue is caused by package @angular/core@^8 Is this a regression? Yes, the previous version in which this bug was not present was: @angular/core@7 Description The ...

X Description: 🐞 bug report Affected Package The issue is caused by package @angular/core@^8 Is this a regression? Yes, the previous version in which this bug was not present was: @angular/core@7 Description The ...

Opengraph URL: https://github.com/angular/angular/issues/31337

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dependency injection and class inheritance doesn't work in Angular 8 library test","articleBody":"# 🐞 bug report\r\n\r\n### Affected Package\r\n\r\nThe issue is caused by package @angular/core@^8\r\n\r\n### Is this a regression?\r\nYes, the previous version in which this bug was not present was: @angular/core@7\r\n\r\n\r\n### Description\r\n\r\nThe problem occurs when:\r\n\r\n1. The base class has a constructor with an injected service. (`Injector` from the example)\r\n\r\n```ts\r\n@Injectable()\r\nexport class BaseService {\r\n  // \"Injector\" is just for the sake of example. Any injectable would have the same problem.\r\n  constructor(public injector: Injector) {\r\n  }\r\n}\r\n```\r\n2. Child class has no constructor (i.e., it relies on base class constructor) AND at least one property with the default value.\r\n\r\n```ts\r\n@Injectable()\r\nexport class MyLibService extends BaseService {\r\n\r\n  public foo = 'bar';\r\n\r\n}\r\n```\r\n\r\n3. (_dont ask me how I have found this, but:_) In `angular.json` `[lib name].test.options.codeCoverage` should be true. \r\n\r\n### PROBLEM:   \r\n\r\n`injector` is undefined in the instance of `MyLibService`. \r\n\r\n--- \r\n\r\n🚩 Removing property from the child class _(2)_ AND/OR opting out `codeCoverage` config in angular.json _(3)_ doesn't brake test.\r\n\r\nAs a result, I can't have a class inheritance and code coverage at the same time.\r\n\r\n---\r\n\r\nI could put a constructor in the child class and call `super` by passing all required arguments manually, but it's the last option since the real-life scenario is much more complicated than the example provided here.\r\n\r\n## 🔬 Minimal Reproduction\r\ngit repo: https://github.com/ddramone/ng-8-library-inheritance-di-test-bug\r\n\r\nreproduce steps:\r\n\r\n1. Install angular 8 cli\r\n2. Clone `git clone https://github.com/ddramone/ng-8-library-inheritance-di-test-bug.git `\r\n3. `npm i`\r\n4. run Test `ng test my-lib`\r\n\r\n ### Expected behavior\r\n\r\nTest should pass = Injector service should be available in the service instance.","author":{"url":"https://github.com/ip7e","@type":"Person","name":"ip7e"},"datePublished":"2019-06-28T14:16:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":17},"url":"https://github.com/31337/angular/issues/31337"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a0be5036-b18f-3cad-0373-69cd623512c9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA34A:877C4:92E3A6:C9322C:6A6193C5
html-safe-nonce1c323fc69615936c1190a4e79085898fed19bc9f27420eea9aadd83ef5738e4a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzRBOjg3N0M0OjkyRTNBNjpDOTMyMkM6NkE2MTkzQzUiLCJ2aXNpdG9yX2lkIjoiMjk0Njc0ODY2OTU0MTU4NTg2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac207a07bd30a8bb405999346109b2a091b567d79ef5564d53ba600c02c6c96da6
hovercard-subject-tagissue:462056786
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/31337/issue_layout
twitter:imagehttps://opengraph.githubassets.com/567cc2521bf3404f1f4a26f1f11c5f9acca96a33fc397519e6cd5af41f77617d/angular/angular/issues/31337
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/567cc2521bf3404f1f4a26f1f11c5f9acca96a33fc397519e6cd5af41f77617d/angular/angular/issues/31337
og:image:alt🐞 bug report Affected Package The issue is caused by package @angular/core@^8 Is this a regression? Yes, the previous version in which this bug was not present was: @angular/core@7 Description The ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameip7e
hostnamegithub.com
expected-hostnamegithub.com
Nonec28c2f6607f2aacbd934868d997038895c9780d08babfe918550d73773326f4c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecd05235d52ffb3318513d883a56c87a121015c8b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/angular/angular/issues/31337#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F31337
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F31337
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/31337
Reloadhttps://github.com/angular/angular/issues/31337
Reloadhttps://github.com/angular/angular/issues/31337
Please reload this pagehttps://github.com/angular/angular/issues/31337
angular https://github.com/angular
angularhttps://github.com/angular/angular
Notifications https://github.com/login?return_to=%2Fangular%2Fangular
Fork 27.5k https://github.com/login?return_to=%2Fangular%2Fangular
Star 101k https://github.com/login?return_to=%2Fangular%2Fangular
Code https://github.com/angular/angular
Issues 978 https://github.com/angular/angular/issues
Pull requests 161 https://github.com/angular/angular/pulls
Discussions https://github.com/angular/angular/discussions
Actions https://github.com/angular/angular/actions
Projects https://github.com/angular/angular/projects
Security and quality 24 https://github.com/angular/angular/security
Insights https://github.com/angular/angular/pulse
Code https://github.com/angular/angular
Issues https://github.com/angular/angular/issues
Pull requests https://github.com/angular/angular/pulls
Discussions https://github.com/angular/angular/discussions
Actions https://github.com/angular/angular/actions
Projects https://github.com/angular/angular/projects
Security and quality https://github.com/angular/angular/security
Insights https://github.com/angular/angular/pulse
Dependency injection and class inheritance doesn't work in Angular 8 library testhttps://github.com/angular/angular/issues/31337#top
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
regressionIndicates than the issue relates to something that worked in a previous versionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22regression%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
Backloghttps://github.com/angular/angular/milestone/82
https://github.com/ip7e
ip7ehttps://github.com/ip7e
on Jun 28, 2019https://github.com/angular/angular/issues/31337#issue-462056786
https://github.com/ddramone/ng-8-library-inheritance-di-test-bughttps://github.com/ddramone/ng-8-library-inheritance-di-test-bug
P2The issue is important to a large percentage of users, with a workaroundhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22P2%22
area: compilerIssues related to `ngc`, Angular's template compilerhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20compiler%22
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
freq1: lowhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
regressionIndicates than the issue relates to something that worked in a previous versionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22regression%22
state: has PRhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22state%3A%20has%20PR%22
type: bug/fixhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%2Ffix%22
BacklogNo due datehttps://github.com/angular/angular/milestone/82
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.