Title: Jasmine createSpyObj w/ properties: Properties lost when spy is provided to and retrieved from TestBed · Issue #33657 · angular/angular · GitHub
Open Graph Title: Jasmine createSpyObj w/ properties: Properties lost when spy is provided to and retrieved from TestBed · Issue #33657 · angular/angular
X Title: Jasmine createSpyObj w/ properties: Properties lost when spy is provided to and retrieved from TestBed · Issue #33657 · angular/angular
Description: 🐞 bug report Is this a regression? No Description Jasmine 3.5.0 added a new parameter to createSpyObj that allows you to specify properties in addition to methods (jasmine/jasmine#1442), however if I create a spy object that way in a bef...
Open Graph Description: 🐞 bug report Is this a regression? No Description Jasmine 3.5.0 added a new parameter to createSpyObj that allows you to specify properties in addition to methods (jasmine/jasmine#1442), however if...
X Description: 🐞 bug report Is this a regression? No Description Jasmine 3.5.0 added a new parameter to createSpyObj that allows you to specify properties in addition to methods (jasmine/jasmine#1442), however if...
Opengraph URL: https://github.com/angular/angular/issues/33657
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Jasmine createSpyObj w/ properties: Properties lost when spy is provided to and retrieved from TestBed","articleBody":"# 🐞 bug report\r\n### Is this a regression?\r\nNo\r\n\r\n\r\n### Description\r\nJasmine 3.5.0 added a new parameter to createSpyObj that allows you to specify properties in addition to methods (https://github.com/jasmine/jasmine/issues/1442), however if I create a spy object that way in a beforeEach() and provide it in TestBed.configureTestingModule, then get it with TestBed.get() in an \"it\" block, the mock function is there but the mock property is not.\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\nhttps://stackblitz.com/edit/angular-issue-repro2-yayobe I tried to make a blitz with a repro but I have no idea how to make it actually run the test.\r\n\r\nThe important part is this:\r\n\r\n```\r\ndescribe('AppComponent', () => {\r\n beforeEach(() => {\r\n\r\n //Note the third parameter\r\n // @ts-ignore\r\n const someServiceSpy = jasmine.createSpyObj('SomeService', ['someFunction'], ['aProperty']);\r\n\r\n TestBed.configureTestingModule({\r\n declarations: [\r\n AppComponent\r\n ],\r\n providers: [\r\n {provide: SomeService, useValue: someServiceSpy},\r\n ]\r\n }).compileComponents();\r\n\r\n });\r\n\r\n it('should create the app', () => {\r\n //spyObj will have someFunction, but will not have aProperty\r\n let spyObj = TestBed.get(SomeService);\r\n });\r\n```\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n\u003cpre>\u003ccode>\r\n\u003c!-- run `ng version` and paste output below -->\r\nAngular CLI: 7.3.9\r\nNode: 10.15.0\r\nOS: win32 x64\r\nAngular: 7.2.15\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... http, platform-browser, platform-browser-dynamic\r\n... platform-server, router\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.8.9\r\n@angular-devkit/build-angular 0.8.9\r\n@angular-devkit/build-optimizer 0.8.9\r\n@angular-devkit/build-webpack 0.8.9\r\n@angular-devkit/core 0.8.9\r\n@angular-devkit/schematics 7.3.9\r\n@angular/cdk 7.3.7\r\n@angular/cli 7.3.9\r\n@ngtools/webpack 6.2.9\r\n@schematics/angular 7.3.9\r\n@schematics/update 0.13.9\r\nrxjs 6.5.3\r\ntypescript 3.2.4\r\nwebpack 4.16.4\r\n\r\n\u003c/code>\u003c/pre>\r\n","author":{"url":"https://github.com/daleclements","@type":"Person","name":"daleclements"},"datePublished":"2019-11-07T17:14:48Z","url":"https://github.com/angular/angular/issues/33657"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:87fcf034-b0ab-6c85-b118-e4b7dfa4ea1b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0F8:E3C4F:1DD8BB8:2606635:6B0165BE |
| html-safe-nonce | ac90d512afe01e1c14178264d941a4fc5d2dd2683a3f900842cf019cca9e14b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEY4OkUzQzRGOjFERDhCQjg6MjYwNjYzNTo2QjAxNjVCRSIsInZpc2l0b3JfaWQiOiI4MzMzMzE5MTQxMTk2OTE2MTU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 12a3f3e2d5b56bdf4ad455df31d1e5904285b3f51a794b7957ac4f4d1e65bafc |
| hovercard-subject-tag | issue:519401424 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/33657/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2da1cdb82faf261489dcc8ae43f5f13129b8fa0863553c81108224c1078a1230/angular/angular/issues/33657 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2da1cdb82faf261489dcc8ae43f5f13129b8fa0863553c81108224c1078a1230/angular/angular/issues/33657 |
| og:image:alt | 🐞 bug report Is this a regression? No Description Jasmine 3.5.0 added a new parameter to createSpyObj that allows you to specify properties in addition to methods (jasmine/jasmine#1442), however if... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daleclements |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width