現在、ライブラリとして使用されている js ファイルを除外するように JSOver を取得しようとしています。私は以下のantスクリプトのセットを持っています
- JSカバーサーバーを起動する
- JSON レポートの実行と生成
- サーバーを停止する
最後に、sonarqube で使用できるように、Json ファイルを LCov に変換するシェル コマンドがあります。jscoverage.html でもカバレッジを取得しますが、web/ の下にあるすべてのファイルが含まれています。これは望ましくありません。下の画像
以下の Ant スクリプト:
<target name="jstest-start">
<java jar=".../JSCover.jar" fork="true" spawn="true">
<arg value="-ws"/>
<arg value="--report-dir=coverage"/>
<arg value="--document-root=web"/>
<arg value="--port=8082"/>
<!-- Aim is to exclude folder js under web/ as it contains libraries, not source code. Currently does not work -->
<arg value="--no-instrument=web/js/"/>
<arg value="--no-instrument=js/"/>
</java>
<waitfor maxwait="5" maxwaitunit="second" checkevery="250" checkeveryunit="millisecond" timeoutproperty="failed">
<http url="http://localhost:8082/jscoverage.html"/>
</waitfor>
<fail if="failed"/>
</target>
<target name="jstest-run">
<exec dir="/usr/local/CI/phantomjs/bin/" executable="phantomjs" failonerror="true">
<arg line=".../run-jscover-qunit.js http://localhost:8082/index.html"/>
</exec>
</target>
<target name="jstest-stop">
<get src="http://localhost:8082/stop" dest="stop.txt" />
</target>
<target name="jstest" description="Run javascript tests">
<antcall target="jstest-start"/>
<antcall target="jstest-run"/>
<antcall target="jstest-stop"/>
</target>
私のフォルダ構造は次のとおりです。
そして最後に、私のソナー スタンドアロン分析設定:
そのため、JSCover はすべての js ファイルを再帰的に読み取っていて、ソナーやアリからそれを防ぐことはできません。
誰でも光を当てることができますか?