Karma, PhantomJS and es6 Promises

前端 未结 5 1179
野的像风
野的像风 2021-02-05 01:06

I am writing a JavaScript library that uses the new es6 promises. I can test the library in Firefox because promises are defined. However, when I try to test my code with Karma

5条回答
  •  盖世英雄少女心
    2021-02-05 01:28

    You can use karma-babel-preprocessor for files that uses ES6 features. Install it with

    npm install --save-dev karma-babel-preprocessor

    and then add specify what files should be preprocessed you karma.conf:

    preprocessors: {
          "src/**/*.js": ["babel"],
          "test/**/*.js": ["babel"]
        },
    

提交回复
热议问题