據伊斯坦布爾幫助蓋輸出
$ ./node_modules/.bin/istanbul help cover
Usage: istanbul cover [<options>] <executable-js-file-or-command> [--<arguments-to-jsfile>]
Options are:
--config <path-to-config>
the configuration file to use, defaults to .istanbul.yml
--root <path>
the root path to look for files to instrument, defaults to .
-x <exclude-pattern> [-x <exclude-pattern>]
one or more glob patterns e.g. "**/vendor/**"
-i <include-pattern> [-i <include-pattern>]
one or more glob patterns e.g. "**/*.js"
--[no-]default-excludes
apply default excludes [ **/node_modules/**, **/test/**,
**/tests/** ], defaults to true
--hook-run-in-context
hook vm.runInThisContext in addition to require (supports
RequireJS), defaults to false
--post-require-hook <file> | <module>
JS module that exports a function for post-require processing
--report <format> [--report <format>]
report format, defaults to lcov (= lcov.info + HTML)
--dir <report-dir>
report directory, defaults to ./coverage
--print <type>
type of report to print to console, one of summary (default),
detail, both or none
--verbose, -v
verbose mode
--[no-]preserve-comments
remove/preserve comments in the output, defaults to false
--include-all-sources
instrument all unused sources after running tests, defaults to
false
--[no-]include-pid
include PID in output coverage filename
你應該用-X從覆蓋報告中排除某些文件。即:
$ ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha test -X dist/index.js
將執行測試,而忽略報告
我的項目的結構更像
server/* public/js* (angular) test/mocha/* (backend tests) test/jasmine/* (angular tests)
位於dist/index.js上覆蓋文件 – simonas88