README.md 7.69 KB
Newer Older
1 2
istanbul-middleware-ry
===================
3 4 5 6 7 8
## Istanbul-middleware-ry is modified from istanbul-middleware
## istanbul-middleware-ry是由istanbul-middleware修改而来
## istanbul-middleware documentation can be found here
http://www.javascriptcn.com/post/50323
## istanbul-middleware 文档可参考
https://blog.csdn.net/heromps/article/details/109356164
9

10
### npm install it:
11

12
```
13
npm install istanbul-middleware -g
14
```
15
### npm安装方法
16
```
17 18 19 20 21 22 23 24
npm install istanbul-middleware -g
```
* npm address:https://www.npmjs.com/package/istanbul-middleware-ry
* Gitlab address:https://git.minrow.com/ry/istanbul-middleware-ry
* npm 地址:https://git.minrow.com/ry/istanbul-middleware-ry
* Gitlab 地址:https://git.minrow.com/ry/babel-plugin-ry-istanbul

## Add global command `coverage` description
25
| property                | explain                                                         | Other (The default wear and)    |
26 27 28 29 30
| ------------------- | ------------------------------------------------------------ | -------- |
| coverage -n  || coverage --nodemon | Start the view service command (nodemon listening service mode) | This command is a local debugging solution |
| coverage -s || coverage --serve | Start the view service command (pm2 listening service mode) | This command is a local debugging solution |
| coverage -c || coverage --close | Close the view service command | Used when a service port fails to close properly |
| coverage -h  || coverage --help | See how to use the command | without |
31 32
## 增加全局方法`coverage`
| 属性                | 说明                                                         | 其他 (默认穿参)    |
33 34 35 36 37
| ------------------- | ------------------------------------------------------------ | -------- |
| coverage -n  || coverage --nodemon | 启动查看服务命令(nodemon监听服务方式) | 此命令为本地调试方案 |
| coverage -s || coverage --serve | 启动查看服务命令(pm2监听服务方式) | 此命令为本地调试方案 |
| coverage -c || coverage --close | 关闭查看服务命令 | 当服务端口未能正常关闭时使用 |
| coverage -h  || coverage --help | 查看命令使用方法 | 无 |
38 39 40 41 42 43 44 45 46 47
## Passable arguments
| property                | explain                                                        | type    | default | other parameters |
| ------------------- | ------------------------------------------------------------ | -------- | ------ | ------ |
| IS_PITCHING_PILE | Whether or not to collect reported data for display. false does not collect data | string | true | true/false |
| FRACTION_OF_COVERAGE_PORT | Port number to start the service | string | 10000 | without |
## 可传入参数
| 属性                | 说明                                                         | 类型    | 默认值 | 其他参数 |
| ------------------- | ------------------------------------------------------------ | -------- | ------ | ------ |
| IS_PITCHING_PILE | 是否收集上报数据进行展示,false则不收集数据 | string | true | true/false |
| FRACTION_OF_COVERAGE_PORT | 启动服务时的端口号 | string | 10000 | 无 |
48 49 50
## Use method and delete interface description
### New usage methods
* New global order 'coverage - n' startup code coverage check service, provide code coverage check services, access: 'http://localhost:10000/coverage/client' can view, related command to view above.
51
* New global parameters`IS_PITCHING_PILE`(whether to display the reported data or not) and`FRACTION_OF_COVERAGE_PORT`(port number to start the service) are added. `coverage -n IS_PITCHING_PILE=true FRACTION_OF_COVERAGE_PORT=10001`
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
* To use the command, install pm2: `npm install pm2@5.2.0 -g --save-dev`
* It is recommended that `nyc` be installed in the project to collect instrumentation files:`npm install nyc --save-dev`
* `nyc` Configuration Using `vue` as an example, add an `nyc` object to `package.json` at the same level as `scripts`, as shown in the following code.
* Add nyc configuration to package.js:
```
{
    "script": {
        ......
    },
    "dependencies": {
        ......
    },
    "devDependencies": {
        ......
    },
    "nyc": {
        "include": [
            "html",
            "text-summary"
        ],
        "extension": [
            ".js",
            ".vue",
            ".jsx"
        ]
    }
78 79
}
```
80 81 82 83 84
### Cut the interface
* Remove the `GET /download` interface
## 使用方法和删减接口说明
### 新增使用方法
* 新增全局命令`coverage -n`启动代码覆盖率查看服务,提供代码覆盖率查看服务,访问:'http://localhost:10000/coverage/client’ 即可查看,相关命令可查看上方命令说明。
85
* 新增全局穿参`IS_PITCHING_PILE`(是否对上报数据进行展示)、`FRACTION_OF_COVERAGE_PORT`(启动服务的端口号),使用方法:`coverage -n IS_PITCHING_PILE=true FRACTION_OF_COVERAGE_PORT=10001`
86 87 88 89
* 使用命令前需在项目代码中安装pm2: `npm install pm2@5.2.0 -g --save-dev`
* 推荐项目中安装`nyc`用于收集插装文件:`npm install nyc --save-dev`
* `nyc`配置以`vue`为例,`package.json`中与`scripts`平级添加`nyc` 对象,如下代码所示。
* Add nyc configuration to package.js:
90
```
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
{
    "script": {
        ......
    },
    "dependencies": {
        ......
    },
    "devDependencies": {
        ......
    },
    "nyc": {
        "include": [
            "html",
            "text-summary"
        ],
        "extension": [
            ".js",
            ".vue",
            ".jsx"
        ]
111
    }
112
}
113
```
114
### 删减接口
115

116
* 删除 `GET /download`接口
117 118


119 120 121 122 123 124 125 126 127 128
## Description of New Features
* A new global command `coverage` is added to start or stop the coverage viewing service
1. Through the (`coverage - n | | coverage - nodemon`) or (`coverage -s || coverage --serve`) start the coverage checking service.
2. Through the `coverage - c | | coverage - close` close coverage checking service.
3. Through the `coverage - h | | coverage -- help` query service coverage
## 新增功能说明
* 新增全局命令`coverage`用于启动或关闭覆盖率查看服务
1. 通过(`coverage -n || coverage --nodemon`)或(`coverage -s || coverage --serve`)启动覆盖率查看服务。
2. 通过`coverage -c || coverage --close`关闭覆盖率查看服务。
3. 通过`coverage -h  || coverage --help`查询覆盖率服务执行命令
129

130 131 132 133 134
## ry-istanbul-web
* NPM address:https://www.npmjs.com/package/ry-istanbul-web
* GitLab address:https://git.minrow.com/ry/istanbul-web
* NPM地址:https://www.npmjs.com/package/ry-istanbul-web
* GitLab地址:https://git.minrow.com/ry/istanbul-web
135

136 137
* [ry-istok-web](https://www.npmjs.com/package/ry-istanbul-web) is modified from [istanbul](https://www.npmjs.com/package/istanbul), adding the changeLists array of window.__coverage__ for viewing the incremental code
* [ry-istok-web](https://www.npmjs.com/package/ry-istanbul-web)是由[istanbul](https://www.npmjs.com/package/istanbul)改装而来,增加window.__coverage__的changeLists数组用于查看增量代码
138

139 140 141 142 143
### babel-plugin-istanbul-ry
* NPM address:https://www.npmjs.com/package/babel-plugin-istanbul-ry
* GitLab address:https://git.minrow.com/ry/babel-plugin-ry-istanbul
* NPM地址:https://www.npmjs.com/package/babel-plugin-istanbul-ry
* GitLab地址:https://git.minrow.com/ry/babel-plugin-ry-istanbul
144

145
* [babel-plugin-istanbul-ry](https://www.npmjs.com/package/babel-plugin-istanbul-ry) bable instrumentation plugin is modified from [babel-plugin-istanbul](https://www.npmjs.com/package/babel-plugin-istanbul) to add incremental code instrumentation methods.
146

147
* [babel-plugin-istanbul-ry](https://www.npmjs.com/package/babel-plugin-istanbul-ry) bable插桩插件由[babel-plugin-istanbul](https://www.npmjs.com/package/babel-plugin-istanbul)改造而来,增加增量代码插桩方法。