PhantomJS does not work with Karma in Angular2 project

后端 未结 3 1359
灰色年华
灰色年华 2021-01-18 01:27

I have created an out-of-the box project with the angular cli (1.0.0-rc1.0.0). Then I installed the PhantomJS plugin (npm install karma-phantonjs-launcher). Reprodu

3条回答
  •  耶瑟儿~
    2021-01-18 02:05

    In fact, you don't have to wait for phantomjs 2.5 release.

    • npm install --save-dev karma-phantomjs-launcher

    • in karma.conf.js

      • add require('karma-phantomjs-launcher') to the plugins section
      • add PhantomJS to the browsers
    • npm install --save intl

    • in src/polyfill.ts
      • add import 'intl'; (uncomment at the bottom)
      • add import "core-js/client/shim"; to the Evergreen requirements section
    • In src/tsconfig.spec.json set the target to es5.

    Ref: https://stackoverflow.com/a/42539894/7683428

提交回复
热议问题