title: Error: clientWidth is not declared configurable in http://localhost:9877node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 4410)
body: <p>I am trying to mock ElementRef properties while unit testing my angular component and it give me the below error</p>
  
  <pre><code>Error: clientWidth is not declared configurable in http://localhost:9877node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 4410)
  </code></pre>
  
  <p>I am getting the error when try to mock the property of native element of an element as below</p>
  
  <pre><code>const div = fixture.debugElement.query(By.css('.ellipsis-overflow'));
  div.triggerEventHandler('mouseover', null);
  fixture.detectChanges();
  expect(component.tooltip.isOpen()).toBeFalsy();
  spyOnProperty(div.nativeElement, 'clientWidth', 'get').and.returnValue(1400);
  spyOnProperty(div.nativeElement, 'scrollWidth', 'get').and.returnValue(2400);
  </code></pre>
  
  <p><code>spyOnProperty</code> is creating that error. </p>