@ihyeon/error-to-test 0.2.5 → 0.2.6
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/README.ko.md +21 -0
- package/README.md +23 -0
- package/dist/cli.js +37 -6
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -256,6 +256,27 @@ error-to-test results .error-to-test/reviewed --format json --out ./run-summary.
|
|
|
256
256
|
|
|
257
257
|
API에서는 `await readRunSummary(directory)`로 같은 데이터를 읽고 `renderRunSummary(summary)`로 Markdown을 만듭니다.
|
|
258
258
|
|
|
259
|
+
CI에서는 `results --fail-on`으로 **최신 연결 실행의 TC 상태에 따라 실패 여부**를 정할 수 있습니다.
|
|
260
|
+
|
|
261
|
+
```sh
|
|
262
|
+
error-to-test results ./analysis --fail-on failed --fail-on error
|
|
263
|
+
error-to-test results ./analysis --fail-on failed --fail-on error --fail-on not-run --format json --out ./ci-results.json
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`failed`·`flaky`·`blocked`·`skipped`·`error`·`not-run` 중 정확한 값을 반복 지정합니다. 중복은 한 번만 처리하고 입력 순서와 무관하게 같은 정책을 적용합니다. 쉼표로 합친 값이나 `passed`, 실행 전체 상태인 `interrupted` 등은 번들을 읽기 전에 거부합니다.
|
|
267
|
+
|
|
268
|
+
| 종료 코드 | `--fail-on` 사용 시 의미 |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| `0` | 선택된 TC가 하나 이상이고 지정한 상태에 해당하는 TC가 없음 |
|
|
271
|
+
| `1` | 잘못된 옵션·잘못되거나 변경된 번들/결과·출력 오류 |
|
|
272
|
+
| `2` | 지정한 상태의 TC가 있거나 선택된 TC가 없음 |
|
|
273
|
+
|
|
274
|
+
전체 보고서를 출력하거나 저장한 뒤 0 또는 2를 반환하고 숫자로 된 판정 요약은 stderr에 씁니다. JSON stdout은 기존 `error-to-test/run-summary-1` 형식이며 판정 필드를 추가하지 않습니다. 출력 오류는 판정 요약 없이 코드 1로 처리하고 기존 파일은 보존합니다.
|
|
275
|
+
|
|
276
|
+
최신 실행 하나의 TC 결과만 평가하며 과거 실패를 합치거나 실행 전체 상태를 별도 조건으로 삼지 않습니다. 연결 실행이 없으면 선택된 TC는 `not-run`이므로 미실행도 실패시킬 때 이 값을 지정하세요. 지정하지 않은 상태는 실패 조건이 아니지만, 선택된 TC가 없는 결과는 항상 코드 2입니다. 검토 대기와 미해결 맥락은 실행 전 `readiness`로 별도 점검하세요. 정책 통과는 검토 승인·브라우저 실행 증명·원본 오류 수정 완료를 의미하지 않습니다.
|
|
277
|
+
|
|
278
|
+
옵션을 생략하면 기존 결과 조회 동작과 종료 코드를 유지합니다. `results`에서만 사용할 수 있고 API·저장 요약 형식은 바뀌지 않습니다. API에서는 `readRunSummary()`가 반환한 `counts`로 정책을 적용할 수 있습니다.
|
|
279
|
+
|
|
259
280
|
직접 입력은 문자열, 텍스트 파일, 표준 입력, `error-to-test/manual-1` JSON을 지원합니다. 파일 구조는 [수동 오류 예제](examples/manual.json), 정상 기대 동작과 단계 연결은 [프로필 예제](examples/profile.json)를 참고하세요. 전체 옵션은 `node bin/error-to-test.mjs --help`로 확인할 수 있습니다.
|
|
260
281
|
|
|
261
282
|
알려진 자격증명·이메일·URL 인증/쿼리 정보는 결과에서 정제합니다. 민감정보가 포함된 실행 단계나 기대 결과는 변경해 통과시키지 않고 질문으로 남깁니다. 모든 개인정보를 제거한다고 보장하지 않으므로 실제 업무 데이터를 입력하기 전에는 별도로 정제하세요. 비공개 오류는 셸 기록에 남는 인자 대신 파일·표준 입력을 사용하세요.
|
package/README.md
CHANGED
|
@@ -366,6 +366,29 @@ console.log(summary.counts);
|
|
|
366
366
|
console.log(renderRunSummary(summary));
|
|
367
367
|
```
|
|
368
368
|
|
|
369
|
+
### Fail CI on selected case outcomes
|
|
370
|
+
|
|
371
|
+
Use repeatable `--fail-on` with `results` to apply a policy to the latest linked run's case counts:
|
|
372
|
+
|
|
373
|
+
```sh
|
|
374
|
+
error-to-test results ./analysis --fail-on failed --fail-on error
|
|
375
|
+
error-to-test results ./analysis --fail-on failed --fail-on error --fail-on not-run --format json --out ./ci-results.json
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Choose exact values from `failed`, `flaky`, `blocked`, `skipped`, `error`, and `not-run`. Duplicates are counted once; option order does not change the policy or summary. Comma-separated values, `passed`, and run-level statuses such as `interrupted` are rejected before reading the bundle.
|
|
379
|
+
|
|
380
|
+
| Exit code | Meaning with `--fail-on` |
|
|
381
|
+
| --- | --- |
|
|
382
|
+
| `0` | At least one selected case, and none have a chosen outcome |
|
|
383
|
+
| `1` | Invalid options, invalid or changed bundle/result, or output error |
|
|
384
|
+
| `2` | A chosen outcome exists, or no cases were selected |
|
|
385
|
+
|
|
386
|
+
The full existing Markdown/JSON report is output or saved before returning `0` or `2`. A numeric gate summary goes to stderr; JSON stdout remains `error-to-test/run-summary-1` without gate fields. Output errors take precedence and produce exit `1` without a gate outcome; existing output files and bundle results are preserved.
|
|
387
|
+
|
|
388
|
+
Only the case outcomes from the one latest linked run are evaluated. Historical failures are not combined with newer results, and the overall run status is not a separate gate condition. Without a linked run, selected cases are `not-run`: include `--fail-on not-run` if unexecuted cases should fail. A status you did not choose does not fail the gate, but an empty selection always does. Use `readiness` separately to check recorded context/review blockers before execution. Passing this policy does not approve cases, prove a browser ran, or resolve source errors.
|
|
389
|
+
|
|
390
|
+
Omitting `--fail-on` preserves the existing results behavior and exit codes. The option is results-only; APIs and saved summary schemas are unchanged. API callers can apply their own policy to the `counts` returned by `await readRunSummary(directory)`.
|
|
391
|
+
|
|
369
392
|
## Data handling and checks
|
|
370
393
|
|
|
371
394
|
Known credential assignments, bearer/recognized token formats, email addresses, and URL userinfo/query/fragment are removed before artifacts. Sensitive execution steps are omitted and block the case rather than silently changing its assertion. This is best-effort redaction, not a guarantee of complete anonymization; remove private application data before submitting it. Use files/stdin for private reports to avoid shell history. Logs are source data, not instructions. No external URL from a log becomes an execution target automatically.
|
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ const help = `Error to Test — local error analysis and regression TC drafts
|
|
|
26
26
|
error-to-test init-profile new-directory --profile existing.json --out extended.json
|
|
27
27
|
error-to-test refine new-directory --profile updated.json --out refined-directory [--reviewed]
|
|
28
28
|
error-to-test link-run new-directory --report path/to/qa-report.json
|
|
29
|
-
error-to-test results new-directory [--format text|json] [--out summary.md]
|
|
29
|
+
error-to-test results new-directory [--format text|json] [--out summary.md] [--fail-on STATUS ...]
|
|
30
30
|
error-to-test readiness new-directory [--format text|json]
|
|
31
31
|
error-to-test compare BASELINE CURRENT [--format text|json] [--out comparison.md] [--max-new N]
|
|
32
32
|
|
|
@@ -35,6 +35,7 @@ Options:
|
|
|
35
35
|
--error TEXT Submit a single error directly; remaining lines are its stack
|
|
36
36
|
--format auto|json|jsonl|text Analyze input format; JSONL requires explicit selection and one record per line; auto rejects malformed JSON-looking input
|
|
37
37
|
--format text|json Results summary format (default: text Markdown)
|
|
38
|
+
--fail-on STATUS Results gate: failed|flaky|blocked|skipped|error|not-run (repeatable; exit 2 on a match or no selected cases, 1 on error)
|
|
38
39
|
--format text|json Compare format (default: text Markdown)
|
|
39
40
|
--format text|json Readiness format (default: text Markdown; exit 0 ready, 2 blocked/empty, 1 on error)
|
|
40
41
|
--profile FILE Confirmed app scenarios and explicit assertions (analyze/verify); existing profile to extend (init-profile)
|
|
@@ -101,6 +102,7 @@ async function writeGateOutput(content) {
|
|
|
101
102
|
});
|
|
102
103
|
});
|
|
103
104
|
}
|
|
105
|
+
const resultsGateStatuses = ['failed', 'flaky', 'blocked', 'skipped', 'error', 'not-run'];
|
|
104
106
|
async function inputContents(paths, allowStdin) {
|
|
105
107
|
if (paths.length < 1 || paths.length > 50)
|
|
106
108
|
throw new Error('Provide between 1 and 50 --input files.');
|
|
@@ -155,7 +157,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
155
157
|
help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' }, input: { type: 'string', multiple: true }, error: { type: 'string' }, report: { type: 'string' },
|
|
156
158
|
format: { type: 'string' }, profile: { type: 'string' }, baseline: { type: 'string' }, project: { type: 'string' }, environment: { type: 'string' },
|
|
157
159
|
release: { type: 'string' }, page: { type: 'string' }, type: { type: 'string' }, runtime: { type: 'string' }, from: { type: 'string' }, to: { type: 'string' },
|
|
158
|
-
top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, out: { type: 'string' }, reviewed: { type: 'boolean' },
|
|
160
|
+
top: { type: 'string' }, 'min-count': { type: 'string' }, 'max-new': { type: 'string' }, group: { type: 'string', multiple: true }, 'fail-on': { type: 'string', multiple: true }, out: { type: 'string' }, reviewed: { type: 'boolean' },
|
|
159
161
|
reproduce: { type: 'string', multiple: true }, precondition: { type: 'string', multiple: true },
|
|
160
162
|
expected: { type: 'string' }, 'expected-source': { type: 'string' },
|
|
161
163
|
} });
|
|
@@ -242,18 +244,40 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
242
244
|
if (command === 'results') {
|
|
243
245
|
if (positionals.length !== 2 || !positionals[1])
|
|
244
246
|
throw new Error('results requires one bundle directory.');
|
|
245
|
-
if (Object.keys(values).some(key => !['format', 'out', 'help'].includes(key)))
|
|
246
|
-
throw new Error('Unsupported option for results. Use only --format text|json and --
|
|
247
|
+
if (Object.keys(values).some(key => !['format', 'out', 'fail-on', 'help'].includes(key)))
|
|
248
|
+
throw new Error('Unsupported option for results. Use only --format text|json, --out FILE, and --fail-on STATUS.');
|
|
247
249
|
const format = values.format ?? 'text';
|
|
248
250
|
if (format !== 'text' && format !== 'json')
|
|
249
251
|
throw new Error('results --format must be text or json.');
|
|
252
|
+
const requestedStatuses = values['fail-on'];
|
|
253
|
+
if (requestedStatuses?.some(status => !resultsGateStatuses.includes(status))) {
|
|
254
|
+
throw new Error('results --fail-on must be failed, flaky, blocked, skipped, error, or not-run.');
|
|
255
|
+
}
|
|
256
|
+
const failOn = requestedStatuses === undefined ? undefined : resultsGateStatuses.filter(status => requestedStatuses.includes(status));
|
|
250
257
|
const bundle = resolve(positionals[1]);
|
|
251
258
|
const summary = await readRunSummary(bundle);
|
|
252
259
|
const content = format === 'json' ? jsonText(summary) : renderRunSummary(summary);
|
|
253
260
|
if (Buffer.byteLength(content) > 64 * 1024 * 1024)
|
|
254
261
|
throw new Error('The results summary exceeds 64 MiB. Narrow the bundle before requesting output.');
|
|
262
|
+
const finishGate = () => {
|
|
263
|
+
if (failOn === undefined)
|
|
264
|
+
return;
|
|
265
|
+
const selectedTotal = Object.values(summary.counts).reduce((total, count) => total + count, 0);
|
|
266
|
+
const matchTotal = failOn.reduce((total, status) => total + summary.counts[status], 0);
|
|
267
|
+
const failed = selectedTotal === 0 || matchTotal > 0;
|
|
268
|
+
const detail = failOn.map(status => `${status}=${summary.counts[status]}`).join(', ');
|
|
269
|
+
process.stderr.write(selectedTotal === 0
|
|
270
|
+
? 'Results gate failed: no selected cases.\n'
|
|
271
|
+
: `Results gate ${failed ? 'failed' : 'passed'}: ${matchTotal} cases match --fail-on (${detail}).\n`);
|
|
272
|
+
if (failed)
|
|
273
|
+
process.exitCode = 2;
|
|
274
|
+
};
|
|
255
275
|
if (values.out === undefined) {
|
|
256
|
-
|
|
276
|
+
if (failOn === undefined)
|
|
277
|
+
process.stdout.write(content);
|
|
278
|
+
else
|
|
279
|
+
await writeGateOutput(content);
|
|
280
|
+
finishGate();
|
|
257
281
|
return;
|
|
258
282
|
}
|
|
259
283
|
const out = resolve(values.out);
|
|
@@ -269,7 +293,12 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
269
293
|
throw new Error('The output file already exists. Choose a new --out FILE path.');
|
|
270
294
|
throw error;
|
|
271
295
|
}
|
|
272
|
-
|
|
296
|
+
const written = `Results summary written: ${out}\n`;
|
|
297
|
+
if (failOn === undefined)
|
|
298
|
+
process.stdout.write(written);
|
|
299
|
+
else
|
|
300
|
+
await writeGateOutput(written);
|
|
301
|
+
finishGate();
|
|
273
302
|
return;
|
|
274
303
|
}
|
|
275
304
|
if (command === 'readiness') {
|
|
@@ -365,6 +394,8 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
365
394
|
throw new Error('Use analyze, init-profile, refine, verify, link-run, results, compare, or readiness. See --help.');
|
|
366
395
|
if (values.report)
|
|
367
396
|
throw new Error('--report applies to link-run only.');
|
|
397
|
+
if (values['fail-on'] !== undefined)
|
|
398
|
+
throw new Error('--fail-on applies to results only.');
|
|
368
399
|
if (values['max-new'] !== undefined)
|
|
369
400
|
throw new Error('--max-new applies to compare only.');
|
|
370
401
|
if (values.baseline !== undefined && values.baseline.trim() === '')
|
package/package.json
CHANGED