鈍足ランナーのIT日記

走るのが好きな5流のITエンジニアのブログ。

趣味の範囲は広いけど、どれも中途半端なクソブロガー楽しめるWebアプリを作ってあっと言わせたい。サーバーサイドPerl(Mojolicious)、クライアントサイドVue.js。Arduinoにも触手を伸ばす予定。

Vue+jestでテスト

以下のエラーが出てテストが通らない。

    console.error node_modules/vue/dist/vue.runtime.common.js:1715
      /Users/dokechin/work/gratan/src/assets/hero.jpeg:1
      ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){����
                                                                                               ^

jestで何か設定が足りないようです。

この辺だろうか・・
webpackのテンプレートに以下のプルリクを発見

github.com

これで、上記エラーは消えた。

次のエラーが現れる

        Failed to write coverage reports:
        ERROR: TypeError: metrics.isEmpty is not a function

これはhttps://github.com/facebook/jest/issues/5772

rm -rf node_modules
rm package-lock.json
npm install

次のエラー現れる

 Failed to write coverage reports:
        ERROR: TypeError: Cannot read property 'decl' of undefined
        STACK: TypeError: Cannot read property 'decl' of undefined
    at /Users/dokechin/work/gratan/node_modules/istanbul-reports/lib/lcovonly/index.js:32:38
    at Array.forEach (<anonymous>)
    at LcovOnlyReport.onDetail (/Users/dokechin/work/gratan/node_modules/istanbul-reports/lib/lcovonly/index.js:30:28)
    at LcovReport.(anonymous function) [as onDetail] (/Users/dokechin/work/gratan/node_modules/istanbul-reports/lib/lcov/index.js:21:24)
    at Visitor.(anonymous function) [as onDetail] (/Users/dokechin/work/gratan/node_modules/istanbul-lib-report/lib/tree.js:34:30)
    at ReportNode.Node.visit (/Users/dokechin/work/gratan/node_modules/istanbul-lib-report/lib/tree.js:123:17)
    at /Users/dokechin/work/gratan/node_modules/istanbul-lib-report/lib/tree.js:116:23
    at Array.forEach (<anonymous>)
    at visitChildren (/Users/dokechin/work/gratan/node_modules/istanbul-lib-report/lib/tree.js:115:32)
    at ReportNode.Node.visit (/Users/dokechin/work/gratan/node_modules/istanbul-lib-report/lib/tree.js:126:5)