highcharts / highcharts-vue

Other
686 stars 150 forks source link

Jest Doc #76

Closed rodhoward closed 5 years ago

rodhoward commented 5 years ago

Hi,

I initially had issues when testing using jest with errors like.

./node_modules/highcharts-vue/src/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Chart from './component'
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

I'm guessing its because of the way this component is packaged.

In any case this was what worked for me inside the jest config:

"transformIgnorePatterns": [
      "<rootDir>/node_modules/(?!highcharts-vue).+\\.js$"
    ],
rodhoward commented 5 years ago

Fixed with:

"transformIgnorePatterns": [
      "<rootDir>/node_modules/(?!highcharts-vue).+\\.js$"
    ],