@luolingp/request-doctor 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/01-/350/275/257/344/273/266/351/234/200/346/261/202/350/247/204/346/240/274/350/257/264/346/230/216.md +1 -1
- package/docs/02-/350/275/257/344/273/266/350/256/276/350/256/241/350/257/264/346/230/216.md +1 -1
- package/docs/03-/350/275/257/344/273/266/346/265/213/350/257/225/346/212/245/345/221/212.md +4 -4
- package/docs/04-/345/256/211/350/243/205/351/203/250/347/275/262/350/257/264/346/230/216.md +1 -1
- package/docs/05-/347/224/250/346/210/267/346/211/213/345/206/214.md +1 -1
- package/docs/06-/350/275/257/344/273/266/350/264/250/351/207/217/345/272/246/351/207/217/346/212/245/345/221/212.md +1 -1
- package/docs/quality-report.json +8 -8
- package/lib/scan-bridge.js +17 -0
- package/lib/verdict-report.js +23 -12
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 软件测试报告
|
|
2
2
|
|
|
3
3
|
**产品名称**:request-doctor(请求急救员)
|
|
4
|
-
**版本**:0.12.
|
|
4
|
+
**版本**:0.12.4
|
|
5
5
|
**编制依据**:GB/T 8567-2006《计算机软件文档编制规范》6.6;GB/T 8566-2007 验证与确认过程
|
|
6
6
|
|
|
7
7
|
---
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
| `test/client-half.test.mjs` | 5 | 客户端半:模块身份、注入声明、apply 注册、组件能渲染 |
|
|
63
63
|
| `test/diagnostics.test.mjs` | 3 | 快照可选写入:不配置不写盘、突发合并、坏路径不致命 |
|
|
64
64
|
| `test/restart-notice.test.mjs` | 3 |
|
|
65
|
-
| `test/verdict-report.test.mjs` |
|
|
66
|
-
| **合计** | **
|
|
65
|
+
| `test/verdict-report.test.mjs` | 15 | why 与 list:判定、理由、环境、自动扫描、扫描中不误报 | 缺导出判为需要重启;其它失败不误判;多次累积不覆盖 |
|
|
66
|
+
| **合计** | **176** | **全部通过** |
|
|
67
67
|
|
|
68
68
|
执行结果:
|
|
69
69
|
|
|
@@ -213,4 +213,4 @@
|
|
|
213
213
|
|
|
214
214
|
### 7.2 分文件执行结果
|
|
215
215
|
|
|
216
|
-
31 个测试文件逐个单独执行,每个都有用例且全部通过,不存在因导入失败而静默跳过的文件。用例数分布:compat.test.mjs 17、plugin.test.mjs 15、compat-env.test.mjs 14、classify.test.mjs 13,其余按职能分散,合计
|
|
216
|
+
31 个测试文件逐个单独执行,每个都有用例且全部通过,不存在因导入失败而静默跳过的文件。用例数分布:compat.test.mjs 17、plugin.test.mjs 15、compat-env.test.mjs 14、classify.test.mjs 13,其余按职能分散,合计 176。
|
package/docs/quality-report.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"standard": "GB/T 45717-2025 信息技术 软件测量 软件质量测量 自动化的源代码质量测度",
|
|
3
|
-
"generatedAt": "2026-10-29T15:
|
|
3
|
+
"generatedAt": "2026-10-29T15:30:57.373Z",
|
|
4
4
|
"scope": {
|
|
5
|
-
"files":
|
|
6
|
-
"totalLines":
|
|
7
|
-
"sourceLines":
|
|
8
|
-
"commentLines":
|
|
5
|
+
"files": 31,
|
|
6
|
+
"totalLines": 5113,
|
|
7
|
+
"sourceLines": 3712,
|
|
8
|
+
"commentLines": 932
|
|
9
9
|
},
|
|
10
10
|
"measures": {
|
|
11
|
-
"commentDensity":
|
|
12
|
-
"duplicationPercent": 4.
|
|
13
|
-
"functionCount":
|
|
11
|
+
"commentDensity": 25.11,
|
|
12
|
+
"duplicationPercent": 4.96,
|
|
13
|
+
"functionCount": 386,
|
|
14
14
|
"maxComplexity": 10,
|
|
15
15
|
"maxFunctionLines": 59,
|
|
16
16
|
"maxFileLines": 500,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// 命令与扫描之间的桥。
|
|
2
|
+
//
|
|
3
|
+
// 命令只想拿一份最新清单,而扫描是异步的:这里负责「没数据就扫一轮」、
|
|
4
|
+
// 「正在扫就别再排」这两件事,命令侧不必各自重复这套判断。
|
|
5
|
+
|
|
6
|
+
// 返回 { scanned, busy }:scanned 表示这一轮是否真触发了扫描,
|
|
7
|
+
// busy 表示调用时是否已经在扫。
|
|
8
|
+
export async function ensureAudited(versionRepair) {
|
|
9
|
+
if (versionRepair === undefined) return { scanned: false, busy: false };
|
|
10
|
+
if (versionRepair.isBusy?.() === true) return { scanned: false, busy: true };
|
|
11
|
+
try {
|
|
12
|
+
await versionRepair.run('list');
|
|
13
|
+
} catch {
|
|
14
|
+
// 扫描失败不影响回答,调用方会如实说还没结果。
|
|
15
|
+
}
|
|
16
|
+
return { scanned: true, busy: false };
|
|
17
|
+
}
|
package/lib/verdict-report.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { linesText } from './text-lines.js';
|
|
2
2
|
|
|
3
|
+
// 已经在扫的时候,告诉用户等一下,而不是报「没有结果」。
|
|
4
|
+
const BUSY_TEXT = '正在扫描,几秒后再执行 /doctor list 就能看到结果。';
|
|
5
|
+
|
|
3
6
|
// 最近一轮审计的清单。没扫过就是空数组。
|
|
4
7
|
function auditedOf(deps) {
|
|
5
8
|
return deps.diagnostics?.versionScan?.audited ?? [];
|
|
6
9
|
}
|
|
7
10
|
|
|
11
|
+
import { ensureAudited } from './scan-bridge.js';
|
|
12
|
+
|
|
8
13
|
// 讲清某个插件为什么被拦下。
|
|
9
14
|
//
|
|
10
15
|
// 审计把判定、理由、缺的符号都记在诊断里,平时只在整轮扫描的输出里一闪而过。
|
|
@@ -13,12 +18,22 @@ function auditedOf(deps) {
|
|
|
13
18
|
// @param {string} name - 插件包名。
|
|
14
19
|
// @param {object} deps - 组合根传进来的依赖,只需要 diagnostics。
|
|
15
20
|
// @returns {{kind: string, text: string}} 命令结果。
|
|
16
|
-
export function explainVerdict(name, deps) {
|
|
21
|
+
export async function explainVerdict(name, deps) {
|
|
17
22
|
if (name === '') return { kind: 'error', text: 'usage: /doctor why <包名>' };
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
const found = find(name, deps);
|
|
24
|
+
if (found !== undefined) return { kind: 'success', text: linesText(reportLines(found)) };
|
|
25
|
+
|
|
26
|
+
// 和 list 一样:没有扫描结果就先扫一轮,正在扫就告诉用户等一下。
|
|
27
|
+
const state = await ensureAudited(deps.versionRepair);
|
|
28
|
+
if (state.busy === true) return { kind: 'success', text: BUSY_TEXT };
|
|
29
|
+
const again = find(name, deps);
|
|
30
|
+
if (again !== undefined) return { kind: 'success', text: linesText(reportLines(again)) };
|
|
31
|
+
return { kind: 'error', text: missingText(name, auditedOf(deps)) };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 在最近一轮审计里按包名找一条。
|
|
35
|
+
function find(name, deps) {
|
|
36
|
+
return auditedOf(deps).find((item) => item.name === name);
|
|
22
37
|
}
|
|
23
38
|
|
|
24
39
|
// 一条一条拼出结论:判定、理由、缺的符号、环境,最后给一句能照做的建议。
|
|
@@ -48,13 +63,9 @@ function advice(verdict) {
|
|
|
48
63
|
// 刚启动时诊断里什么都没有,直接说「还没有结果」等于把活推回给用户。
|
|
49
64
|
// 扫描本身是幂等的,顺手做掉更省事。
|
|
50
65
|
export async function listAudited(deps) {
|
|
51
|
-
if (auditedOf(deps).length
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} catch {
|
|
55
|
-
// 扫描失败不影响回答:下面会如实说还没结果。
|
|
56
|
-
}
|
|
57
|
-
}
|
|
66
|
+
if (auditedOf(deps).length > 0) return formatList(deps);
|
|
67
|
+
const state = await ensureAudited(deps.versionRepair);
|
|
68
|
+
if (state.busy === true) return { kind: 'success', text: BUSY_TEXT };
|
|
58
69
|
return formatList(deps);
|
|
59
70
|
}
|
|
60
71
|
|