Search code examples
phantomjsangular-clipolyfills

Phantomjs error while running tests in angular cli


I am trying to run ng test in Angular Cli project using phantom browser and I am getting below error. I googled it and realized that it has something to do with polyfill (Backward compatibility?). I want to understand what's wrong here and how to fix this issue. Thanks in advance!

PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR TypeError: undefined is not an object (evaluating '(_a = ((Object))).assign.apply') at webpack:///~/@angular/common/src/pipes/intl.js:187:0 <- src/test.ts:34449


Solution

  • you need to uncomment those from your polyfills.ts

    import 'core-js/es6/object';
    import 'core-js/es6/array';
    import 'intl';  // Run `npm install --save intl`.