bjc
v1.0.23
Published
bjc is an OpenHarmony ets instrument tool.
Readme
bjc
Description
bjc is an OpenHarmony ets instrument tool.
Installation
npm install bjcBuild
Install dependencies
npm iBuild & Pack
npm run build
npm packInstructions
1. Usage
Usage: bjc [options] [command]
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
report <input> [output] parse coverage data to generate report.
instrument <input> [output]
install <sdk_home>
help [command] display help for command2. Using in command-line-tools
- Download command-line-tools
Command Line Tools
bjc is integrated into hvigor and the bjc code can be seen in the directory
${command-line-tools}\hvigor\hvigor-ohos-plugin\node_modules\@ohos\coverage\lib\src\bjc
${DevEco Studio}\tools\hvigor\hvigor-ohos-plugin\node_modules\@ohos\coverage\lib\src\bjc- hvigor build Hap & instrument coverage
hvigorw -p buildMode=debug -p ohos-test-coverage=true -p coverage-mode=black -p debugLine=true clean assembleHsp assembleHapFor more details, please refer to the URL https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-ui-test
3. Coverage file storage location
/data/app/el2/100/base/${bundleName}/haps/{entryModuleName}/cache/bjc_cov_xxx.json4. Instrument ignore feature
ignore file
Add a comment to the source file // instrument ignore file or /* instrument ignore file */. after adding the comment, the file will no longer be instrumented, and the coverage report will not have the file.
ignore next
Add // instrument ignore next or /* instrument ignore next */ in front of the code block.
ignore if
Add // instrument ignore if or /* instrument ignore if */in front of the conditional expression to ignore if branch.
ignore else
Add // instrument ignore else or /* instrument ignore else */in front of the conditional expression to ignore else branch.
