title: Error: <spyOnProperty> : function is not declared configurable
body: <p>I had working jasmine tests with webpack 3. Now I try to use it with webpack 4 but have some problem with it.</p>
  
  <p>Firstly I had problem with <em>spyOn</em> function.</p>
  
  <blockquote>
    <p>Error:  : myFunction is not declared writable or has no setter</p>
  </blockquote>
  
  <p>I found some articles about some workaround for this problem: <a href="https://medium.com/@juanlizarazo/how-to-spy-on-a-property-getter-or-setter-with-jasmine-ad06c00ba612" rel="noreferrer">spy-on-getter-and-setter</a></p>
  
  <p>I changed <em>spyOn</em> to <em>spyOnProperty</em> but with no luck. Now I have problem with </p>
  
  <p><strong>> Error:  : myFunction is not declared configurable</strong></p>
  
  <p>My code is written in js and looks like this:</p>
  
  <pre><code>import * as FocusServiceSpy from '../focus/FocusService';
  
  describe('#onLinkClick', function() {
              it('should call myFunction', () =&gt; {
                  spyOnProperty(FocusServiceSpy, 'myFunction', 'get');
                  expect(FocusServiceSpy.myFunction).toHaveBeenCalled();
              });
  
          }
  </code></pre>
  
  <p>Do you know what could be a problem with this?</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>I should be more descriptive. I would like to create spy on function of the <em>FocusService</em>. This service has only one method called <em>myFunction</em>. Only thing I want to achieve is to ensure that this method will be called.</p>
  
  <p>Now I changed it to sth like this and have error: </p>
  
  <p><strong>>TypeError: Object is not a constructor (evaluating 'new FocusService()') (line 180)
      </strong></p>
  
  <pre><code>describe('#onLinkClick', function() {
          const FocusService = require('../focus/FocusService');
  
          it('should call myFunction', () =&gt; {
              const service = new FocusService();
              spyOnProperty(service, 'myFunction').and.callThrough();
              ... (do some action)
              expect(service.myFunction).toHaveBeenCalled();
          });
  
      }
  </code></pre>
  
  <p><em>FocusService</em> looks like this:</p>
  
  <pre><code>export function myFunction(arg) {
      ... (do some action)
  }
  </code></pre>