カバレッジ レポートの livereload を有効にしようとしています。このレポートを生成するための私のツールはkarma-coverageで、このレポートを次のフォルダーに生成します: test/coverage/html-report
-test
|
|-- coverage
|
|-- report-html
|
|-- index.html
レポートが生成されたら、grunt-contrib-connectを使用し、次を使用して生成されたレポートを提供します。
var COVERAGE_BASE = './test/coverage/report-html',
...
...
...
connect: {
server: {
options: {
port: 9000,
base: '.',
open: false
}
},
dist:{
options: {
keepalive: true,
port: 9000,
base: './dist',
open: false
}
},
coverage: {
options: {
keepalive: true,
port: 9001,
base: COVERAGE_BASE ,
open: false
}
}
}
私のタスクを実行するとgrunt coverage
、私の設定は
COVERAGE_TASKS = ['shell:test','open:coverage', 'connect:coverage','watch'];
grunt.registerTask('coverage', COVERAGE_TASKS);
私の考えでは、index.html を「インターセプト」し、livereload にスクリプトを挿入します。
<script src="//localhost:35729/livereload.js"></script>
接続パッケージで提供する前に index.html をインターセプトし、このスクリプトを追加するために処理する方法はありますか?