dsh-flakefinder 0.4.22 → 0.5.0
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/CHANGELOG.md +15 -0
- package/README.en.md +4 -3
- package/README.md +4 -3
- package/cordis.patch.yml +10 -6
- package/docs/REFERENCE.en.md +4 -3
- package/docs/REFERENCE.zh.md +4 -3
- package/docs/USAGE.en.md +73 -22
- package/docs/USAGE.md +74 -40
- package/lib/adapters.d.ts +123 -0
- package/lib/adapters.js +377 -0
- package/lib/args.d.ts +2 -17
- package/lib/args.js +2 -112
- package/lib/classify.d.ts +61 -11
- package/lib/classify.js +561 -44
- package/lib/config.d.ts +26 -1
- package/lib/config.js +125 -4
- package/lib/index.d.ts +6 -4
- package/lib/index.js +46 -9
- package/lib/parse.d.ts +16 -6
- package/lib/parse.js +499 -37
- package/lib/runner.d.ts +29 -2
- package/lib/runner.js +221 -19
- package/lib/store.d.ts +87 -8
- package/lib/store.js +389 -35
- package/lib/tools.d.ts +4 -4
- package/lib/tools.js +691 -101
- package/lib/update-client.js +12 -193
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 0.5.0 (2026-11-22)
|
|
4
|
+
|
|
5
|
+
- 核心正确性修复:修复混合 `stable-fail` + `flaky`(`passRuns=0`)误判稳定失败及合成 `(crash)`/`(timeout)` 失败率;单轮超时不再中断整批检测并区分宿主取消信号;新增 `lossy` 输出截断检测;升级层级 TAP 13 解析器(叶子用例去重、去除顺序号防并发串位、提取 YAML 耗时与堆栈)与 JUnit XML 严格校验;支持 Monorepo 向上查找 `node_modules`、工作区 `.venv`/`venv` 自动探测与 Windows 路径规范化。
|
|
6
|
+
- 诊断与执行力升级:新增报错指纹聚类与脱敏精简堆栈、每用例单轮时间线(`✓/✗/⏱/S/-`)、通过/失败耗时对比、6 类根因模式画像与 95% 置信度提示;`flaky_detect` 新增 `testName` 过滤、`mode`(`full` / `until-flaky` / `verify-fix`)早停、`concurrency`(1–4)、`shuffle`/`seed` 随机顺序复现与 `noCoverage` 默认跳过覆盖率;抽离 `FrameworkAdapter` 注册表架构。
|
|
7
|
+
- 工作区隔离与闭环联动:检测历史按工作区独立存储(保留 `scope=all` 兼容旧记录);修复 `.flakefinder.json` 隔离写入匹配缺陷并保留首次 `since`、新增可选 `updatedAt`/`issue`/`lastFailureRate` 与相对 POSIX 路径归一化;`flaky_detect` 自动标注 `[新增未隔离]`/`[已隔离]`/可消单候选,`flaky_report` 新增高频不稳定 Top N 榜单与超期未复查提醒;丰富审批弹窗内容,升级 `flaky_health` 为工作区感知自检。
|
|
8
|
+
- Core correctness & reliability fixes: ensure test-level `flakyCount > 0` always yields top-level `flaky` verdict; record per-run timeouts gracefully without aborting remaining runs (preserving host abort cancellation); detect `lossy` output truncation; upgrade to a hierarchical TAP 13 + YAML diagnostics parser with deterministic order-independent leaf IDs and strict JUnit XML validation; add upward monorepo `node_modules` and workspace `.venv`/`venv` discovery plus Windows path normalization.
|
|
9
|
+
- Diagnostics & execution controls: add secret-redacted error fingerprinting with compact representative stacks, per-test timelines, pass-vs-fail duration stats, 6 root-cause pattern heuristics, and 95% confidence upper bounds; extend `flaky_detect` with `testName`, `mode` (`full` / `until-flaky` / `verify-fix`), `concurrency` (1–4), `shuffle`/`seed`, and `noCoverage` (default `true`); extract the `FrameworkAdapter` registry.
|
|
10
|
+
- Workspace isolation & quarantine feedback loop: isolate history per workspace (with `scope=all` legacy compatibility); fix quarantine add/update matching while preserving original `since` and enforcing relative POSIX paths; cross-annotate `flaky_detect` with new/quarantined/clear-candidate items; add Top-N hotspots and stale-quarantine warnings in `flaky_report`; enrich approval prompts and make `flaky_health` workspace-aware.
|
|
11
|
+
|
|
12
|
+
## 0.4.23 (2026-11-20)
|
|
13
|
+
|
|
14
|
+
- 升级共享更新组件至 0.2.10,移除跨插件右下角浮动提醒,保留工作台及插件详情页更新控制。
|
|
15
|
+
|
|
16
|
+
- 保留混合 JUnit 用例的身份和原始顺序,修正 time 秒到毫秒;TAP 不重复纳入嵌套用例,TODO 按跳过处理。
|
|
17
|
+
|
|
3
18
|
## 0.4.22 (2026-11-20)
|
|
4
19
|
|
|
5
20
|
- 修复测试进程在报告写出后崩溃或被终止却仍判定稳定通过的问题;TAP / JSON / JUnit 都校验进程结果,保留已产生的断言与历史格式,并在摘要中呈现运行异常。
|
package/README.en.md
CHANGED
|
@@ -19,9 +19,10 @@ Flaky test investigation plugin for DeepSeek Harness (`>=0.2.2-rc.3`): runs Vite
|
|
|
19
19
|
|
|
20
20
|
## Features
|
|
21
21
|
|
|
22
|
-
- Investigate Vitest, Jest, pytest and node:test runs.
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
- Investigate Vitest, Jest, pytest, and `node:test` runs with monorepo upward framework resolution and automatic workspace `.venv` detection.
|
|
23
|
+
- Support targeted filtering (`testName`), early-stop modes (`until-flaky` / `verify-fix`), bounded concurrency (1–4 workers), and shuffled order with reproducible seeds (`shuffle` / `seed`).
|
|
24
|
+
- Cluster deduplicated errors with redacted stacks, render per-run timelines, infer root-cause patterns (cold-start, state-leak, timeout-race, order-dependent, teardown-crash), and report 95% confidence bounds.
|
|
25
|
+
- Keep workspace-isolated detection history, cross-check `.flakefinder.json` quarantine lists, surface top flaky hotspots and stale quarantine reminders, and list exact affected tests in approval prompts.
|
|
25
26
|
|
|
26
27
|
## Install
|
|
27
28
|
|
package/README.md
CHANGED
|
@@ -19,9 +19,10 @@ DeepSeek Harness(`>=0.2.2-rc.3`)偶发测试排查插件:面向 Vitest、J
|
|
|
19
19
|
|
|
20
20
|
## 功能
|
|
21
21
|
|
|
22
|
-
- 支持 Vitest、Jest、pytest 与 node:test
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
- 支持 Vitest、Jest、pytest 与 `node:test` 复跑调查(支持 monorepo 向上查找框架与工作区 `.venv` 自动探测)。
|
|
23
|
+
- 支持用例名过滤(`testName`)、早停模式(`until-flaky` / `verify-fix`)、受控并发(1–4 路)与随机顺序打乱(`shuffle` / `seed`)。
|
|
24
|
+
- 自动聚合错误聚类、提取脱敏堆栈、输出通过/失败时间线与根因模式(冷启动、状态泄漏、超时竞态、顺序依赖、清理阶段崩溃)及 95% 置信度提示。
|
|
25
|
+
- 按工作区隔离检测历史,交叉对照 `.flakefinder.json` 隔离清单,输出高频不稳定 Top 榜单与超期未复查提醒,并在审批弹窗中展示完整待隔离/移除条目。
|
|
25
26
|
|
|
26
27
|
## 安装
|
|
27
28
|
|
package/cordis.patch.yml
CHANGED
|
@@ -5,12 +5,16 @@
|
|
|
5
5
|
# - id: flakefinder
|
|
6
6
|
# name: 'dsh-flakefinder'
|
|
7
7
|
# config:
|
|
8
|
-
# defaultRuns: 5
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
8
|
+
# defaultRuns: 5 # flaky_detect 默认重复次数(3-20)
|
|
9
|
+
# maxRuns: 20 # 单次运行允许的最大重复次数(3-50)
|
|
10
|
+
# defaultConcurrency: 1 # flaky_detect 默认并发 worker 数(1-4)
|
|
11
|
+
# noCoverage: true # 默认关闭覆盖率采集以加速复跑(Vitest/Jest 生效)
|
|
12
|
+
# staleQuarantineDays: 14 # 隔离清单条目超期未复查提醒天数(1-365)
|
|
13
|
+
# timeoutMs: 120000 # 单次测试运行超时(毫秒)
|
|
14
|
+
# writeApproval: true # quarantine/clear 是否走审批门(默认 true)
|
|
15
|
+
# dataDir: '' # 历史存储目录(默认 DSH_HOME/.dsh-flakefinder)
|
|
16
|
+
# quarantineFile: '' # 隔离清单(默认工作区根 .flakefinder.json)
|
|
17
|
+
# pythonPath: '' # pytest 使用的 Python 解释器(默认自动探测 .venv / python/python3)
|
|
14
18
|
#
|
|
15
19
|
- insert:
|
|
16
20
|
- id: flakefinder
|
package/docs/REFERENCE.en.md
CHANGED
|
@@ -16,9 +16,10 @@ Feedback and contributions are welcome: report [issues](https://github.com/STARD
|
|
|
16
16
|
|
|
17
17
|
## What it does
|
|
18
18
|
|
|
19
|
-
- Support Vitest, Jest, pytest and node:test.
|
|
20
|
-
-
|
|
21
|
-
-
|
|
19
|
+
- Support Vitest, Jest, pytest, and `node:test` (including monorepo upward module lookup, hierarchical TAP 13 diagnostics, and automatic workspace `.venv` discovery).
|
|
20
|
+
- Support targeted filtering (`testName`), `until-flaky` / `verify-fix` early stopping, bounded concurrency (1–4), coverage disabled by default, and `shuffle` / `seed` order randomization.
|
|
21
|
+
- Provide deduplicated error clusters with secret-redacted stacks, per-run timelines, duration stats, root-cause pattern hints, 95% confidence bounds, and quarantine cross-annotation.
|
|
22
|
+
- Isolate detection history per workspace, summarize top flaky hotspots and stale quarantine items, and run workspace-aware `flaky_health` diagnostics.
|
|
22
23
|
|
|
23
24
|
## Install
|
|
24
25
|
|
package/docs/REFERENCE.zh.md
CHANGED
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
## 功能
|
|
18
18
|
|
|
19
|
-
- 支持 Vitest、Jest、pytest
|
|
20
|
-
-
|
|
21
|
-
-
|
|
19
|
+
- 支持 Vitest、Jest、pytest 与 `node:test`(含 monorepo 向上查找依赖、`node:test` 层级 TAP 13 诊断解析与工作区 `.venv` 自动探测)。
|
|
20
|
+
- 支持精准用例过滤(`testName`)、`until-flaky` / `verify-fix` 早停、受控并发(1–4 路)、默认跳过覆盖率与 `shuffle` / `seed` 顺序打乱。
|
|
21
|
+
- 输出去重错误聚类(带密钥脱敏堆栈)、时间线、耗时分布、根因模式标签、95% 置信度提示与隔离清单交叉对照。
|
|
22
|
+
- 按工作区隔离历史记录,汇总高频不稳定 Top 榜单与超期未复查隔离项,并提供工作区感知的 `flaky_health` 自检。
|
|
22
23
|
|
|
23
24
|
## 安装
|
|
24
25
|
|
package/docs/USAGE.en.md
CHANGED
|
@@ -2,25 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
## Confirmation in Full Access
|
|
4
4
|
|
|
5
|
-
The plugin keeps its confirmation requirement. With approval policy `never`, it reports that confirmation is unavailable and performs no write. Switch to a mode that can ask, or explicitly set `writeApproval: false` yourself. Host denials still apply.
|
|
5
|
+
The plugin keeps its confirmation requirement and displays the full list of tests to be quarantined or cleared (plus reason/issue for `flaky_quarantine`) inside the approval prompt. With approval policy `never`, it reports that confirmation is unavailable and performs no write. Switch to a mode that can ask, or explicitly set `writeApproval: false` yourself. Host denials still apply.
|
|
6
6
|
|
|
7
7
|
[Overview](../README.en.md) · [Changelog](../CHANGELOG.md) · [Validation](VALIDATION.md)
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Highlights
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **Workspace-aware & isolated**: Detection history is stored per workspace under `dataDir/workspaces/<hash>.json` (while remaining compatible with legacy `history.json`). Relative `quarantineFile` defaults to `.flakefinder.json` in the active session workspace, normalizing paths to workspace-relative POSIX paths and rejecting out-of-workspace absolute paths.
|
|
12
|
+
- **Fast targeted reruns**: Supports test-name filtering (`testName`), early-stop modes (`until-flaky` / `verify-fix`), bounded concurrency (`1`–`4` workers), coverage disabled by default (`noCoverage`), and order shuffling with reproducible seeds (`shuffle` / `seed`).
|
|
13
|
+
- **Root-cause diagnostics & confidence**: Deduplicates failures into error clusters (normalizing timestamps/UUIDs/ports and redacting secrets in stacks), renders per-run timelines (`✓`/`✗`/`⏱`/`S`/`-`), compares passing vs. failing durations, infers 6 flake patterns (`cold-start`, `state-leak`, `timeout-race`, `order-dependent`, `teardown-crash`, `intermittent`), and prints 95% confidence upper bounds on all-pass runs.
|
|
14
|
+
- **Quarantine loop & reporting**: `flaky_detect` cross-checks `.flakefinder.json` to tag `[新增未隔离]` / `[已隔离]` flaky tests and surface `clearCandidates`; `flaky_report` adds top flaky hotspots and stale quarantine reminders.
|
|
15
|
+
- **Safety & resilience**: Cancellation aborts active test processes without writing partial history; concurrent writes use `proper-lockfile`; corrupt JSON files fail loudly while preserving the original file; payloads with >60 tests automatically cap `stable-pass` entries to protect context size.
|
|
12
16
|
|
|
13
17
|
## Tools
|
|
14
18
|
|
|
15
19
|
| Tool | Purpose | Write |
|
|
16
20
|
| :-- | :-- | :-- |
|
|
17
|
-
| `flaky_detect` | Repeat tests N times
|
|
18
|
-
| `flaky_history` | Query detection history, filter by target | no |
|
|
19
|
-
| `flaky_report` | Combine quarantine manifest
|
|
20
|
-
| `flaky_quarantine` |
|
|
21
|
-
| `flaky_clear` | Remove recovered cases from the manifest | yes (approval) |
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
| `flaky_detect` | Repeat tests N times with timeline, error clusters, root-cause patterns, and quarantine sync | history only |
|
|
22
|
+
| `flaky_history` | Query detection history, filter by `target`, switch `scope` (`workspace` / `all`) | no |
|
|
23
|
+
| `flaky_report` | Combine quarantine manifest, top flaky hotspots, stale quarantine alerts, and history | no |
|
|
24
|
+
| `flaky_quarantine` | Add or update flaky entries in `.flakefinder.json` (with optional `issue` / `lastFailureRate`) | yes (approval) |
|
|
25
|
+
| `flaky_clear` | Remove recovered cases from the quarantine manifest | yes (approval) |
|
|
26
|
+
| `flaky_health` | Workspace-aware health check: Node version, detected frameworks, Python/pytest, store readability, defaults | no |
|
|
27
|
+
|
|
28
|
+
### `flaky_detect` parameters
|
|
29
|
+
|
|
30
|
+
| Parameter | Type | Default | Description |
|
|
31
|
+
| :-- | :-- | :-- | :-- |
|
|
32
|
+
| `target` | `string` (required) | — | Test file, directory, or glob relative to workspace (cannot start with `-`) |
|
|
33
|
+
| `framework` | `enum` | `auto` | `auto` / `vitest` / `jest` / `pytest` / `node` (aliases `node:test`, `py` also accepted) |
|
|
34
|
+
| `runs` | `integer` | `defaultRuns` | Repeat count (`3`–`maxRuns`) |
|
|
35
|
+
| `testName` | `string` | — | Filter tests by name/pattern (Vitest/Jest `-t`, pytest `-k`, `node:test` `--test-name-pattern`) |
|
|
36
|
+
| `mode` | `enum` | `full` | `full` (run all) / `until-flaky` (stop once flake confirmed) / `verify-fix` (stop on first failure) |
|
|
37
|
+
| `concurrency` | `integer` | `defaultConcurrency` | Worker concurrency (`1`–`4`) |
|
|
38
|
+
| `shuffle` | `boolean` | `false` | Randomize test order (Vitest/Jest; generates a distinct seed per run if `seed` is omitted) |
|
|
39
|
+
| `seed` | `integer` | — | Explicit RNG seed (`0`–`2147483647`) for reproducible shuffled runs |
|
|
40
|
+
| `noCoverage` | `boolean` | `noCoverage` config | Disable coverage collection during reruns (Vitest/Jest, default `true`) |
|
|
41
|
+
|
|
42
|
+
### Supported frameworks
|
|
43
|
+
|
|
44
|
+
- **vitest**: Walks up from workspace to locate hoisted `node_modules/vitest/vitest.mjs`; JSON reporter; supports `-t`, `--coverage.enabled=false`, `--sequence.shuffle --sequence.seed=...`.
|
|
45
|
+
- **jest**: Walks up to locate `node_modules/jest/bin/jest.js`; `--json --outputFile`; uses `--runInBand` when serial and unshuffled; supports `-t`, `--coverage=false`, `--randomize --seed=...`.
|
|
46
|
+
- **pytest**: Resolves Python in priority order `explicit pythonPath > DSH_FLAKEFINDER_PYTHON > VIRTUAL_ENV > workspace .venv/venv > platform default`, runs `python -m pytest -q --junitxml=...` with `-k`, CDATA/XML entity decoding, and `<system-err>` fallback.
|
|
47
|
+
- **node:test**: Runs `node --test --test-reporter=tap` with `--test-name-pattern=...`, hierarchical TAP 13 + YAML diagnostic block parsing, `SKIP`/`TODO` handling, and `Bail out!` detection.
|
|
48
|
+
- `framework: auto` detects in order: `vitest → jest → pytest → node:test`.
|
|
24
49
|
|
|
25
50
|
## Install
|
|
26
51
|
|
|
@@ -39,30 +64,56 @@ Then restart the web service. To clean up fully, also remove the plugin entry fr
|
|
|
39
64
|
## Example
|
|
40
65
|
|
|
41
66
|
```text
|
|
42
|
-
User: src/checkout.test.ts keeps
|
|
67
|
+
User: The timer test in src/checkout.test.ts keeps flaking in CI, can you investigate?
|
|
68
|
+
Agent:
|
|
69
|
+
flaky_detect(target="src/checkout.test.ts", testName="timer restore", runs=10, concurrency=2, mode="until-flaky")
|
|
70
|
+
-> verdict: flaky (ran 4/10; timeline ✓✓✗✓; pattern: timeout-race; clustered TimeoutError)
|
|
71
|
+
-> flaky_quarantine(tests=["src/checkout.test.ts > timer restore"], reason="timer race", issue="#12", lastFailureRate=25)
|
|
72
|
+
|
|
73
|
+
User: Fixed the timer cleanup — please verify it stays green.
|
|
43
74
|
Agent:
|
|
44
|
-
flaky_detect(target="src/checkout.test.ts", runs=
|
|
45
|
-
-> verdict:
|
|
46
|
-
->
|
|
75
|
+
flaky_detect(target="src/checkout.test.ts", testName="timer restore", runs=15, mode="verify-fix")
|
|
76
|
+
-> verdict: stable-pass (95% confidence residual flake rate <= 18.1%; clear candidate detected)
|
|
77
|
+
-> flaky_clear(tests=["src/checkout.test.ts > timer restore"])
|
|
47
78
|
```
|
|
48
79
|
|
|
49
80
|
## Config
|
|
50
81
|
|
|
51
|
-
See `cordis.patch.yml
|
|
82
|
+
See `cordis.patch.yml`. Key options:
|
|
83
|
+
|
|
84
|
+
| Field | Default | Description |
|
|
85
|
+
| :-- | :-- | :-- |
|
|
86
|
+
| `defaultRuns` | `5` | Default rerun count for `flaky_detect` (`3`–`20`) |
|
|
87
|
+
| `maxRuns` | `20` | Maximum allowed rerun count (`3`–`50`) |
|
|
88
|
+
| `defaultConcurrency` | `1` | Default worker concurrency (`1`–`4`) |
|
|
89
|
+
| `noCoverage` | `true` | Disable coverage collection during Vitest/Jest reruns |
|
|
90
|
+
| `staleQuarantineDays` | `14` | Days before a quarantine entry is flagged as stale in `flaky_report` (`1`–`365`) |
|
|
91
|
+
| `timeoutMs` | `120000` | Per-run timeout in milliseconds (`10000`–`600000`) |
|
|
92
|
+
| `graceMs` | `10000` | Grace period after timeout (`1000`–`120000`) |
|
|
93
|
+
| `writeApproval` | `true` | Gate `flaky_quarantine` and `flaky_clear` behind host approval |
|
|
94
|
+
| `dataDir` | `DSH_HOME/.dsh-flakefinder` | Root directory for workspace-isolated history |
|
|
95
|
+
| `quarantineFile` | `<cwd>/.flakefinder.json` | Quarantine manifest path (relative paths resolve against the session workspace) |
|
|
96
|
+
| `pythonPath` | auto `.venv` or `python`/`python3` | Python interpreter for pytest runs (`DSH_FLAKEFINDER_PYTHON` supported) |
|
|
97
|
+
|
|
98
|
+
## Requirements & runtime
|
|
99
|
+
|
|
100
|
+
- Requires **Node `>= 22.19`** (`^22.19.0 || >=24.0.0`) and **DSH `>= 0.2.2-rc.3`**.
|
|
101
|
+
- Runtime dependencies: `proper-lockfile` and `@stardustlc/dsh-updates`.
|
|
102
|
+
- Test subprocesses always execute via DSH's `subprocess` service using `argv` arrays (no shell).
|
|
52
103
|
|
|
53
104
|
## Troubleshooting
|
|
54
105
|
|
|
55
|
-
Run `flaky_health` first: it
|
|
106
|
+
Run `flaky_health` first: it inspects the active workspace's Node version, auto-detected test framework paths, Python/pytest (missing pytest is treated as informational/optional in JS-only workspaces and only fails health when pytest config is present or `pythonPath` is explicitly configured), `.flakefinder.json` and history readability, and default config.
|
|
56
107
|
|
|
57
108
|
| Symptom | Usual cause | What to do |
|
|
58
109
|
| :-- | :-- | :-- |
|
|
59
|
-
| Verdict says no tests were parsed | `target` matched nothing, or only skipped tests | Point `target` at real test files/directories (globs work), or pass `framework` explicitly |
|
|
60
|
-
|
|
|
61
|
-
| `framework=vitest` cannot find `node_modules/vitest` | Not installed, or invoked outside the project |
|
|
62
|
-
| pytest
|
|
63
|
-
| Quarantine/clear
|
|
110
|
+
| Verdict says no tests were parsed | `target` or `testName` matched nothing, or only skipped tests | Point `target` at real test files/directories (globs work), verify `testName`, or pass `framework` explicitly |
|
|
111
|
+
| Run anomaly / timeout / truncated output | Missing CLI, per-run timeout exceeded, TAP output > 4MB, or post-assertion teardown crash | Inspect error clusters and stderr tail; raise `timeoutMs` or narrow scope with `testName` |
|
|
112
|
+
| `framework=vitest` cannot find `node_modules/vitest` | Not installed, or invoked outside the project/monorepo | Run inside the repository that installed Vitest, or set `framework` |
|
|
113
|
+
| Python workspace `flaky_health` fails on pytest | Virtualenv or pytest missing | Run `pip install pytest`, or point `pythonPath` at the right interpreter |
|
|
114
|
+
| Quarantine/clear matched 0 entries | Reference format or path does not match the manifest | Use `"relative/path > test name"`; inspect current entries with `flaky_report` |
|
|
64
115
|
|
|
65
|
-
The `flaky_detect` summary always ends with the next step: quarantine flaky tests, reproduce stable failures, or clear recovered
|
|
116
|
+
The `flaky_detect` summary always ends with the next step: quarantine new flaky tests, reproduce stable failures, or clear recovered quarantine entries.
|
|
66
117
|
|
|
67
118
|
## Development
|
|
68
119
|
|
package/docs/USAGE.md
CHANGED
|
@@ -2,31 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
## 完全权限下的确认
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
插件保留单独确认要求,并在审批弹窗中展示即将写入或移除的完整用例列表(以及隔离原因/关联 issue)。会话审批策略为 `never` 时不能弹框,会明确说明操作未执行;请切到可询问模式,或由用户明确设置 `writeApproval: false`。其它宿主拒绝仍生效,不自动放宽权限。
|
|
6
6
|
|
|
7
7
|
[返回简介](../README.md) · [更新记录](../CHANGELOG.md) · [验证记录](VALIDATION.md)
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 核心能力
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **工作区感知与隔离**:历史记录按工作区分别存储于 `dataDir/workspaces/<hash>.json`(兼容旧版 `history.json`);相对 `quarantineFile` 默认落在当前工作区 `.flakefinder.json`,路径自动规范化为 POSIX 相对路径并拒绝越界绝对路径。
|
|
12
|
+
- **高效精准复跑**:支持按用例名过滤(`testName`)、早停模式(`until-flaky` / `verify-fix`)、受控并发(`concurrency` 1–4 路)、默认跳过覆盖率(`noCoverage`)以及随机顺序打乱与种子复现(`shuffle` / `seed`)。
|
|
13
|
+
- **根因诊断与置信度**:自动聚合去重错误聚类(归一化时间戳/UUID/端口等噪声并脱敏密钥堆栈),输出通过/失败时间线(`✓`/`✗`/`⏱`/`S`/`-`)、通过与失败耗时对比、6 类根因模式提示(`cold-start` / `state-leak` / `timeout-race` / `order-dependent` / `teardown-crash` / `intermittent`),以及全绿时的 95% 置信度残余偶发率上界。
|
|
14
|
+
- **隔离闭环与报告**:`flaky_detect` 自动对照 `.flakefinder.json` 标注 `[新增未隔离]`、`[已隔离]` 与可解除隔离候选;`flaky_report` 汇总历史高频不稳定 Top 5 榜单与超期未复查提醒。
|
|
15
|
+
- **安全与容错**:取消信号立即中止测试进程且不写脏历史;并发写入受文件锁保护;损坏的 JSON 文件报错并保留原文件;超 60 个用例时自动精简 `stable-pass` 条目保护上下文窗口。
|
|
12
16
|
|
|
13
17
|
## 工具
|
|
14
18
|
|
|
15
19
|
| 工具 | 作用 | 写操作 |
|
|
16
20
|
| :-- | :-- | :-- |
|
|
17
|
-
| `flaky_detect` |
|
|
18
|
-
| `flaky_history` |
|
|
19
|
-
| `flaky_report` |
|
|
20
|
-
| `flaky_quarantine` | 把 flaky 用例写入 `.flakefinder.json`
|
|
21
|
-
| `flaky_clear` |
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
| `flaky_detect` | 多轮复跑测试并输出判定、时间线、错误聚类、根因模式与隔离对照 | 否(写历史) |
|
|
22
|
+
| `flaky_history` | 查询检测历史,支持按 `target` 过滤与 `scope`(`workspace` / `all`)切换 | 否 |
|
|
23
|
+
| `flaky_report` | 汇总隔离清单、高频不稳定 Top 5、超期隔离提醒与历史趋势 | 否 |
|
|
24
|
+
| `flaky_quarantine` | 把 flaky 用例写入 `.flakefinder.json`(支持 `issue`、`lastFailureRate` 与增量更新) | 是(审批门) |
|
|
25
|
+
| `flaky_clear` | 从隔离清单移除已恢复稳定的用例 | 是(审批门) |
|
|
26
|
+
| `flaky_health` | 工作区感知自检:Node 版本、自动探测框架、Python/pytest、清单与历史可读性、默认配置 | 否 |
|
|
27
|
+
|
|
28
|
+
### `flaky_detect` 参数
|
|
29
|
+
|
|
30
|
+
| 参数 | 类型 | 默认 | 说明 |
|
|
31
|
+
| :-- | :-- | :-- | :-- |
|
|
32
|
+
| `target` | `string`(必填) | — | 测试文件、目录或 glob(相对工作区,不能以 `-` 开头) |
|
|
33
|
+
| `framework` | `enum` | `auto` | `auto` / `vitest` / `jest` / `pytest` / `node`(也接受别名 `node:test`、`py`) |
|
|
34
|
+
| `runs` | `integer` | `defaultRuns` | 重复次数(`3`–`maxRuns`) |
|
|
35
|
+
| `testName` | `string` | — | 按用例名过滤(Vitest/Jest `-t`、pytest `-k`、`node:test` `--test-name-pattern`) |
|
|
36
|
+
| `mode` | `enum` | `full` | `full`(跑满次数)/ `until-flaky`(确认不稳定即早停)/ `verify-fix`(首次失败即早停) |
|
|
37
|
+
| `concurrency` | `integer` | `defaultConcurrency` | 并发 worker 数(`1`–`4`) |
|
|
38
|
+
| `shuffle` | `boolean` | `false` | 是否打乱执行顺序(Vitest/Jest 生效;未指定 `seed` 时每轮生成不同随机种子) |
|
|
39
|
+
| `seed` | `integer` | — | 随机种子(`0`–`2147483647`),配合 `shuffle` 复现特定顺序失败 |
|
|
40
|
+
| `noCoverage` | `boolean` | `noCoverage` 配置 | 是否关闭覆盖率采集加速复跑(Vitest/Jest 生效,默认 `true`) |
|
|
41
|
+
|
|
42
|
+
### 支持框架
|
|
43
|
+
|
|
44
|
+
- **vitest**:从工作区向上查找 `node_modules/vitest/vitest.mjs`(适配 monorepo hoisted 依赖),使用 JSON reporter;支持 `-t`、`--coverage.enabled=false`、`--sequence.shuffle --sequence.seed=...`。
|
|
45
|
+
- **jest**:从工作区向上查找 `node_modules/jest/bin/jest.js`,使用 `--json --outputFile`;单并发非打乱默认带 `--runInBand`;支持 `-t`、`--coverage=false`、`--randomize --seed=...`。
|
|
46
|
+
- **pytest**:按 `显式 pythonPath > DSH_FLAKEFINDER_PYTHON > VIRTUAL_ENV > 工作区 .venv/venv > 默认 python/python3` 解析解释器,运行 `python -m pytest -q --junitxml=...`(支持 `pytest.ini` / `tox.ini` / `pyproject.toml` / `setup.cfg` 探测、`-k` 过滤、CDATA 与 XML 实体解码及 `<system-err>` 回退)。
|
|
47
|
+
- **node:test**:运行 `node --test --test-reporter=tap`,支持 `--test-name-pattern=...`、层级 TAP 13(含 YAML 诊断块与堆栈提取)、`SKIP`/`TODO` 指令与 `Bail out!` 识别。
|
|
48
|
+
- `framework: auto` 按 `vitest → jest → pytest → node:test` 优先级自动探测。
|
|
30
49
|
|
|
31
50
|
## 安装
|
|
32
51
|
|
|
@@ -41,6 +60,9 @@ dsh plugin --profile web add dsh-flakefinder
|
|
|
41
60
|
name: 'dsh-flakefinder'
|
|
42
61
|
config:
|
|
43
62
|
defaultRuns: 5
|
|
63
|
+
defaultConcurrency: 1
|
|
64
|
+
noCoverage: true
|
|
65
|
+
staleQuarantineDays: 14
|
|
44
66
|
writeApproval: true
|
|
45
67
|
```
|
|
46
68
|
|
|
@@ -55,25 +77,34 @@ dsh plugin --profile web remove dsh-flakefinder
|
|
|
55
77
|
## 使用示例
|
|
56
78
|
|
|
57
79
|
```text
|
|
58
|
-
用户:src/checkout.test.ts
|
|
80
|
+
用户:src/checkout.test.ts 里的定时器用例最近老飘红,帮我查一下
|
|
81
|
+
Agent:
|
|
82
|
+
flaky_detect(target="src/checkout.test.ts", testName="定时器恢复", runs=10, concurrency=2, mode="until-flaky")
|
|
83
|
+
→ 判定:不稳定(flaky);实际运行 4/10 次;时间线 ✓✓✗✓;模式:超时/竞态;错误聚类 [1次]:TimeoutError
|
|
84
|
+
→ flaky_quarantine(tests=["src/checkout.test.ts > 定时器恢复"], reason="定时器竞态", issue="#12", lastFailureRate=25)
|
|
85
|
+
|
|
86
|
+
用户:修完定时器和清理钩子了,帮我复测验证
|
|
59
87
|
Agent:
|
|
60
|
-
flaky_detect(target="src/checkout.test.ts", runs=
|
|
61
|
-
→
|
|
62
|
-
→
|
|
88
|
+
flaky_detect(target="src/checkout.test.ts", testName="定时器恢复", runs=15, mode="verify-fix")
|
|
89
|
+
→ 判定:稳定通过;95% 置信下残余偶发率 ≤ 18.1%;命中可解除隔离候选
|
|
90
|
+
→ flaky_clear(tests=["src/checkout.test.ts > 定时器恢复"])
|
|
63
91
|
```
|
|
64
92
|
|
|
65
93
|
## 配置
|
|
66
94
|
|
|
67
95
|
| 字段 | 默认 | 说明 |
|
|
68
96
|
| :-- | :-- | :-- |
|
|
69
|
-
| `defaultRuns` | `5` | `flaky_detect`
|
|
70
|
-
| `maxRuns` | `20` |
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
97
|
+
| `defaultRuns` | `5` | `flaky_detect` 默认重复次数(`3`–`20`) |
|
|
98
|
+
| `maxRuns` | `20` | 单次允许的最大重复次数(`3`–`50`) |
|
|
99
|
+
| `defaultConcurrency` | `1` | `flaky_detect` 默认并发 worker 数(`1`–`4`) |
|
|
100
|
+
| `noCoverage` | `true` | 默认关闭覆盖率采集以加速复跑(Vitest/Jest 生效) |
|
|
101
|
+
| `staleQuarantineDays` | `14` | `flaky_report` 超期未复查隔离项提醒阈值(`1`–`365` 天) |
|
|
102
|
+
| `timeoutMs` | `120000` | 单轮测试运行超时(毫秒,`10000`–`600000`) |
|
|
103
|
+
| `graceMs` | `10000` | 超时后宽限(毫秒,`1000`–`120000`) |
|
|
73
104
|
| `writeApproval` | `true` | 隔离清单写操作是否走审批门 |
|
|
74
|
-
| `dataDir` | `DSH_HOME/.dsh-flakefinder` |
|
|
75
|
-
| `quarantineFile` | `<cwd>/.flakefinder.json` |
|
|
76
|
-
| `pythonPath` | `
|
|
105
|
+
| `dataDir` | `DSH_HOME/.dsh-flakefinder` | 历史存储根目录(按工作区分文件) |
|
|
106
|
+
| `quarantineFile` | `<cwd>/.flakefinder.json` | 隔离清单路径(相对路径按当前会话工作区解析) |
|
|
107
|
+
| `pythonPath` | 自动探测 `.venv` 或 `python`/`python3` | pytest 使用的 Python 解释器(显式配置或 `DSH_FLAKEFINDER_PYTHON` 优先) |
|
|
77
108
|
|
|
78
109
|
## 隔离清单格式
|
|
79
110
|
|
|
@@ -85,42 +116,45 @@ Agent:
|
|
|
85
116
|
"file": "src/checkout.test.ts",
|
|
86
117
|
"name": "使用假定时器后恢复真实定时器",
|
|
87
118
|
"reason": "定时器竞态,见 issue #12",
|
|
88
|
-
"since": "2026-08-16T00:00:00.000Z"
|
|
119
|
+
"since": "2026-08-16T00:00:00.000Z",
|
|
120
|
+
"updatedAt": "2026-08-20T00:00:00.000Z",
|
|
121
|
+
"lastFailureRate": 25,
|
|
122
|
+
"issue": "#12"
|
|
89
123
|
}
|
|
90
124
|
]
|
|
91
125
|
}
|
|
92
126
|
```
|
|
93
127
|
|
|
94
|
-
隔离清单只记录,不修改测试源码;agent 跑测试前应先查阅 `flaky_report
|
|
128
|
+
隔离清单只记录,不修改测试源码;agent 跑测试前应先查阅 `flaky_report`。重复对同一条目执行 `flaky_quarantine` 会保留原始 `since` 并更新 `reason`、`updatedAt` 及可选元数据。
|
|
95
129
|
|
|
96
130
|
## 工程
|
|
97
131
|
|
|
98
|
-
- Node >= 22.
|
|
132
|
+
- Node `^22.19.0 || >=24.0.0`(即 `Node >= 22.19`),TypeScript,运行时依赖 `proper-lockfile` 与 `@stardustlc/dsh-updates`
|
|
99
133
|
- 测试进程走 DSH 官方 subprocess 服务,argv 数组、无 shell
|
|
100
|
-
-
|
|
101
|
-
- `pnpm test
|
|
134
|
+
- 完整自动化测试覆盖:适配器与配置、JSON/JUnit/TAP 13 诊断解析、错误聚类与根因模式、工作区存储隔离、批次并发与早停、工具集成与真实 `node --test` 端到端测试、审批门与 manifest
|
|
135
|
+
- `pnpm test`:构建(`tsc` + `build-updates.mjs`)+ `node --test "test/*.test.mjs"`
|
|
102
136
|
|
|
103
137
|
## 发布门禁
|
|
104
138
|
|
|
105
139
|
1. `pnpm test` 全绿
|
|
106
|
-
2. `pnpm typecheck`
|
|
140
|
+
2. `pnpm typecheck` 零报错
|
|
107
141
|
3. 危险模式扫描(eval / child_process / 密钥零容忍)
|
|
108
142
|
4. 真实 profile 冒烟:全新临时 profile 安装插件 → 真 boot → stderr 零报错
|
|
109
143
|
5. manifest 自检(bundle patch / exports / files 白名单)
|
|
110
144
|
|
|
111
145
|
## 故障排查
|
|
112
146
|
|
|
113
|
-
先运行 `flaky_health
|
|
147
|
+
先运行 `flaky_health`:它按当前工作区检查 Node 版本、自动探测到的框架路径、Python/pytest(纯 JS/TS 工作区中 pytest 缺失仅标记为可选提示,不会误报自检失败;存在 pytest 配置或显式配置 `pythonPath` 时缺失才会报 ❌)、`.flakefinder.json` 与历史文件可读性,并汇总默认配置。
|
|
114
148
|
|
|
115
149
|
| 现象 | 常见原因 | 处理 |
|
|
116
150
|
| :-- | :-- | :-- |
|
|
117
|
-
| 判定「没有解析到用例」 | target
|
|
118
|
-
|
|
|
119
|
-
| `framework=vitest` 报找不到 `node_modules/vitest` |
|
|
120
|
-
| pytest
|
|
121
|
-
| 隔离/清除返回 0 条 | 引用格式或路径与清单不一致 | 用 `"
|
|
151
|
+
| 判定「没有解析到用例」 | `target` 或 `testName` 没匹配到用例,或文件里只有被跳过的用例 | 确认 `target` 指向真实测试文件/目录,检查 `testName` 模式,必要时显式指定 `framework` |
|
|
152
|
+
| 提示「运行异常汇总」或超时 | 框架 CLI 缺失、单轮超时、TAP 输出超过 4MB 被截断、或断言后清理阶段崩溃 | 查看摘要里的错误聚类与 stderr 尾部;按需调大 `timeoutMs` 或用 `testName` 缩小范围 |
|
|
153
|
+
| `framework=vitest` 报找不到 `node_modules/vitest` | 未安装依赖,或工作区路径不在项目/monorepo 内 | 在安装了框架的仓库内调用,或显式指定 `framework` |
|
|
154
|
+
| Python 工作区 `flaky_health` 报 pytest 失败 | 虚拟环境未创建或未安装 pytest | 运行 `pip install pytest`,或在配置中设置 `pythonPath` 指向对应解释器 |
|
|
155
|
+
| 隔离/清除返回 0 条 | 引用格式或路径与清单不一致 | 用 `"相对路径 > 用例名"` 格式;先 `flaky_report` 看清单现有条目 |
|
|
122
156
|
|
|
123
|
-
`flaky_detect` 的摘要会给出下一步:flaky
|
|
157
|
+
`flaky_detect` 的摘要会给出下一步:flaky 先隔离并结合模式/错误聚类定位,稳定失败先单跑定位,稳定通过且命中已隔离项时可直接 `flaky_clear`。
|
|
124
158
|
|
|
125
159
|
## License
|
|
126
160
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 测试框架适配器与注册表:覆盖 vitest / jest / pytest / node:test,
|
|
3
|
+
* 支持 monorepo 向上查找 node_modules、workspace .venv 自动探测、
|
|
4
|
+
* 精准过滤、关闭覆盖率与顺序打乱(shuffle + seed)。
|
|
5
|
+
* 全程 argv 数组、无 shell,避免 npx 下载与命令注入。
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-flakefinder/adapters
|
|
8
|
+
*/
|
|
9
|
+
import { type ResolvedFlakeConfig } from './config.js';
|
|
10
|
+
export type ConcreteFramework = 'vitest' | 'jest' | 'pytest' | 'node';
|
|
11
|
+
export type Framework = 'auto' | ConcreteFramework;
|
|
12
|
+
export type ReportKind = 'json' | 'tap' | 'junit';
|
|
13
|
+
export interface PlanBuildOptions {
|
|
14
|
+
/** 按用例名/模式过滤单个或多个用例。 */
|
|
15
|
+
testName?: string;
|
|
16
|
+
/** 是否关闭覆盖率采集以加速复跑(默认 true,对 vitest / jest 生效)。 */
|
|
17
|
+
noCoverage?: boolean;
|
|
18
|
+
/** 是否打乱测试执行顺序(对 vitest / jest 生效)。 */
|
|
19
|
+
shuffle?: boolean;
|
|
20
|
+
/** 随机种子(0-2147483647);与 shuffle 配合或单独传入用于复现。 */
|
|
21
|
+
seed?: number;
|
|
22
|
+
/** 外部批次并发数;Jest 在 concurrency<=1 且未开启 shuffle 时默认带 --runInBand。 */
|
|
23
|
+
concurrency?: number;
|
|
24
|
+
/** pythonPath 是否由用户显式配置(为 true 时跳过 .venv 自动探测)。 */
|
|
25
|
+
pythonPathExplicit?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TestPlan {
|
|
28
|
+
framework: ConcreteFramework;
|
|
29
|
+
reportKind: ReportKind;
|
|
30
|
+
reportPath: string;
|
|
31
|
+
argv: string[];
|
|
32
|
+
label: string;
|
|
33
|
+
seed?: number;
|
|
34
|
+
target?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface AdapterContext {
|
|
37
|
+
cwd: string;
|
|
38
|
+
target: string;
|
|
39
|
+
runIndex: number;
|
|
40
|
+
token: string;
|
|
41
|
+
pythonPath?: string;
|
|
42
|
+
options?: PlanBuildOptions;
|
|
43
|
+
}
|
|
44
|
+
/** 面向未来框架扩展(如 Playwright / Go)的标准适配器契约。 */
|
|
45
|
+
export interface FrameworkAdapter {
|
|
46
|
+
readonly id: ConcreteFramework;
|
|
47
|
+
readonly aliases?: readonly string[];
|
|
48
|
+
readonly reportKind: ReportKind;
|
|
49
|
+
/** auto 探测优先级,数字越小越优先。 */
|
|
50
|
+
readonly priority: number;
|
|
51
|
+
/** 显式指定该框架时,是否要求本地入口必须存在。 */
|
|
52
|
+
readonly requireLocalOnExplicit?: boolean;
|
|
53
|
+
/** 探测当前工作区是否具备该框架(返回入口或配置文件路径,未找到返回 null)。 */
|
|
54
|
+
detect(cwd: string): string | null;
|
|
55
|
+
/** 显式指定但本地缺失时的中文指引。 */
|
|
56
|
+
missingMessage?(cwd: string): string;
|
|
57
|
+
/** 构建单轮执行的完整计划。 */
|
|
58
|
+
buildPlan(ctx: AdapterContext): TestPlan;
|
|
59
|
+
}
|
|
60
|
+
export type PythonPathSource = 'explicit' | 'virtual-env' | 'workspace-venv' | 'default';
|
|
61
|
+
export interface PythonResolution {
|
|
62
|
+
pythonPath: string;
|
|
63
|
+
source: PythonPathSource;
|
|
64
|
+
}
|
|
65
|
+
export interface EnvironmentDetection {
|
|
66
|
+
cwd: string;
|
|
67
|
+
defaultFramework: ConcreteFramework;
|
|
68
|
+
nodeVersion: string;
|
|
69
|
+
nodePath: string;
|
|
70
|
+
vitest: {
|
|
71
|
+
available: boolean;
|
|
72
|
+
entryPath: string | null;
|
|
73
|
+
};
|
|
74
|
+
jest: {
|
|
75
|
+
available: boolean;
|
|
76
|
+
entryPath: string | null;
|
|
77
|
+
};
|
|
78
|
+
pytest: {
|
|
79
|
+
configFound: boolean;
|
|
80
|
+
configPath: string | null;
|
|
81
|
+
pythonPath: string;
|
|
82
|
+
pythonSource: PythonPathSource;
|
|
83
|
+
};
|
|
84
|
+
frameworks: {
|
|
85
|
+
vitest: string | null;
|
|
86
|
+
jest: string | null;
|
|
87
|
+
pytestConfig: string | null;
|
|
88
|
+
pythonPath: string;
|
|
89
|
+
node: string;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** 从 cwd 向上逐级查找本地 node_modules 里的 CLI 入口(适配 monorepo hoisted 依赖)。 */
|
|
93
|
+
export declare function findLocalModuleEntry(cwd: string, ...parts: string[]): string | null;
|
|
94
|
+
/** 在 cwd 中查找 pytest 配置文件路径。 */
|
|
95
|
+
export declare function findPytestConfig(cwd: string): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* 解析 pytest 使用的 Python 解释器路径及来源。
|
|
98
|
+
* 当用户未显式配置 pythonPath / DSH_FLAKEFINDER_PYTHON 时,按顺序自动探测:
|
|
99
|
+
* VIRTUAL_ENV -> 向上查找 .venv / venv -> 平台默认 python / python3。
|
|
100
|
+
*/
|
|
101
|
+
export declare function resolvePythonPathInfo(cwd: string, cfg?: Pick<ResolvedFlakeConfig, 'pythonPath' | 'pythonPathExplicit'>, runtime?: {
|
|
102
|
+
env?: NodeJS.ProcessEnv;
|
|
103
|
+
platform?: NodeJS.Platform;
|
|
104
|
+
}): PythonResolution;
|
|
105
|
+
/** 解析 pytest 使用的 Python 解释器路径。 */
|
|
106
|
+
export declare function resolvePythonPath(cwd: string, cfg?: Pick<ResolvedFlakeConfig, 'pythonPath' | 'pythonPathExplicit'>, runtime?: {
|
|
107
|
+
env?: NodeJS.ProcessEnv;
|
|
108
|
+
platform?: NodeJS.Platform;
|
|
109
|
+
}): string;
|
|
110
|
+
/** 注册一个测试框架适配器(覆盖同 id 适配器并更新别名映射)。 */
|
|
111
|
+
export declare function registerAdapter(adapter: FrameworkAdapter): void;
|
|
112
|
+
/** 按框架 id 获取适配器。 */
|
|
113
|
+
export declare function getAdapter(id: ConcreteFramework): FrameworkAdapter;
|
|
114
|
+
/** 返回按 auto 优先级排序的所有已注册适配器。 */
|
|
115
|
+
export declare function listAdapters(): FrameworkAdapter[];
|
|
116
|
+
/** 解析 framework 参数(含别名 node:test -> node、py -> pytest);非法值抛中文错误。 */
|
|
117
|
+
export declare function readFramework(raw: unknown): Framework;
|
|
118
|
+
/** 在 cwd 里探测本地框架 CLI 入口;显式指定时缺失会给出中文指引。 */
|
|
119
|
+
export declare function detectFramework(cwd: string, requested: Framework): ConcreteFramework;
|
|
120
|
+
/** 构建一次测试运行的执行计划。runIndex 仅用于给临时报告文件命名。 */
|
|
121
|
+
export declare function buildPlan(cwd: string, target: string, requested: Framework, runIndex: number, pythonPath?: string, options?: PlanBuildOptions): TestPlan;
|
|
122
|
+
/** 汇总当前工作区可用的测试框架与解释器环境,供 flaky_health 自检使用。 */
|
|
123
|
+
export declare function detectEnvironment(cwd: string, cfg?: Pick<ResolvedFlakeConfig, 'pythonPath' | 'pythonPathExplicit'>): EnvironmentDetection;
|