2

モカテスト+イスタンブールカバレッジを使用して、typescript + babel(stage-1 + react)プロジェクトのセットアップを既に作成しています。Mocha は次のように構成されています。webpack は istanbul-instrumenter-loader を使用して tmp ディレクトリに commonjs バンドルをビルドします。エントリ ポイントは./**/*.spec.(t|j)sx?、jsx?に一致するファイルです。ローダーは次のようになります。

loaders: [
   'istanbul-instrumenter-loader',
   "source-map-loader",
   'babel-loader',
],

source-map-loaderローダーに渡されるsourceMapを各バンドルファイルの[file base name].map(たとえば)ファイルに書き込むだけのモジュールはどこですか。app.js.mapビルドが完了したら、モカの gulp タスクを実行して、このすべてのバンドルをモカ ランナーに追加し、テストを開始して、カバレッジ情報を収集します。

昨日、remap-istanbul プロジェクトを見つけて、構成しようとしました。ここで remap を追加したカバレッジ レポート モジュールを確認できます。次の出力で常に失敗します。

/app/node_modules/istanbul/lib/store/memory.js:38
     throw new Error('Unable to find entry for [' + key + ']');
     ^

Error: Unable to find entry for [src/actions/appointments.js]
  at MemoryStore.Store.mix.get  (/app/node_modules/istanbul/lib/store/memory.js:38:19)
  at HtmlReport.Report.mix.writeDetailPage (/app/node_modules/istanbul/lib/report/html.js:411:67)
  at /app/node_modules/istanbul/lib/report/html.js:489:26
  at SyncFileWriter.extend.writeFile (/app/node_modules/istanbul/lib/util/file-writer.js:57:9)
  at FileWriter.extend.writeFile (/app/node_modules/istanbul/lib/util/file-writer.js:147:23)
  at /app/node_modules/istanbul/lib/report/html.js:488:24
  at Array.forEach (native)
  at HtmlReport.Report.mix.writeFiles (/app/node_modules/istanbul/lib/report/html.js:482:23)
  at /app/node_modules/istanbul/lib/report/html.js:484:22
  at Array.forEach (native)

テスト実行とカバレッジ コレクションのデバッグを試みましたが、ファイル パスが壊れている理由がわかりませんでした。おそらく、webpack のソースマップが原因であると思われます。

4

0 に答える 0