Jasmine spyOn fails after moving to Webpack4
Jasmine spyOn fails after moving to Webpack4 Recently I'm migrating a project from webpack 3 -> 4. There's an issue wit karma/jasmine tests. In my test I want to import a TypeScript namespace object and mock it. webpack karma/jasmine spyOn(AlertDialogModule, 'createAlertDialog') .and.returnValue( Promise.resolve(alertDialogMock) ); But I have an error Error: : createAlertDialog is not declared writable or has no setter I think, the reason is in how WP4 handles harmony exports /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; ...
