
Close #33657 in jasmine 3.5, there is a new feature, user can pass a properties object to `jasmine.createSpyObj` ``` const spy = jasmine.createSpyObj('spy', ['method1'], {prop1: 'foo'}); expect(spy.prop1).toEqual('foo'); ``` This case will not work for Angular TestBed, for example, ``` describe('AppComponent', () => { beforeEach(() => { //Note the third parameter // @ts-ignore const someServiceSpy = jasmine.createSpyObj('SomeService', ['someFunction'], ['aProperty']); TestBed.configureTestingModule({ declarations: [ AppComponent ], providers: [ {provide: SomeService, useValue: someServiceSpy}, ] }).compileComponents(); }); it('should create the app', () => { //spyObj will have someFunction, but will not have aProperty let spyObj = TestBed.get(SomeService); }); ``` Because `jasmine.createSpyObj` will create the `aProperty` with `enumerable=false`, and `TestBed.configureTestingModule` will try to copy all the properties from spyObj to the injected service instance. And because `enumerable` is false, so the property (here is aProperty) will not be copied. This PR will monkey patch the `jasmine.createSpyObj` and make sure the new property's `enumerable=true`. PR Close #34624
Angular
Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages.
Quickstart
Changelog
Learn about the latest improvements.
Want to help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.
Description
Languages
TypeScript
86.3%
JavaScript
8.5%
HTML
1.8%
Starlark
1.7%
CSS
1%
Other
0.6%