# bjc

> bjc is an OpenHarmony ets instrument tool.

Latest version **1.0.23** (published 2025-09-10) · 0 weekly downloads

## Install

```sh
npm install bjc
pnpm add bjc
yarn add bjc
bun add bjc
```

Provides the command `bjc`.

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.23 |
| Published | 2025-09-10 |
| First published | 2024-07-18 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 3.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | code-sunbo |

## Links

- npm: https://www.npmjs.com/package/bjc
- npm.io page: https://npm.io/package/bjc

## Dependencies (7)

- [json5](https://npm.io/package/json5.md) ^2.2.3
- [log4js](https://npm.io/package/log4js.md) ^6.7.1
- [commander](https://npm.io/package/commander.md) ^12.0.0
- [typescript](https://npm.io/package/typescript.md) ^5.1.6
- [@types/json5](https://npm.io/package/@types/json5.md) ^2.2.0
- [html-escaper](https://npm.io/package/html-escaper.md) ^3.0.3
- [@types/html-escaper](https://npm.io/package/@types/html-escaper.md) ^3.0.2

## Recent versions

- 1.0.23 (latest) — 2025-09-10
- 1.0.22 — 2025-08-18
- 1.0.21 — 2025-08-18
- 1.0.20 — 2025-08-01
- 1.0.19 — 2024-12-30
- 1.0.18 — 2024-11-11
- 1.0.17 — 2024-11-08
- 1.0.16 — 2024-11-08
- 1.0.15 — 2024-11-08
- 1.0.14 — 2024-09-30
- 1.0.13 — 2024-09-14
- 1.0.11 — 2024-09-05
- 1.0.10 — 2024-08-12
- 1.0.9 — 2024-07-30
- 1.0.8 — 2024-07-27
- … 8 more at https://npm.io/package/bjc/versions

## README

# bjc

## Description
bjc is an OpenHarmony ets instrument tool.

## Installation
```
npm install bjc
```

## Build
Install dependencies
```
npm i
```
Build & Pack
```
npm run build
npm pack
```

## Instructions

### 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 command
```

### 2. Using in command-line-tools
1. Download command-line-tools  
[Command Line Tools](https://developer.huawei.com/consumer/cn/download/)

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
```
2. hvigor build Hap & instrument coverage
```
hvigorw -p buildMode=debug -p ohos-test-coverage=true -p coverage-mode=black -p debugLine=true clean assembleHsp assembleHap
```
For 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.json
```

### 4. 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.

---
_Source: https://npm.io/package/bjc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
