@elench/testkit 0.1.45 → 0.1.46

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.md CHANGED
@@ -184,6 +184,12 @@ failure:
184
184
  - title does not match the linked issue title
185
185
  - local open/closed state does not match the linked issue state
186
186
 
187
+ Reproduction warnings are execution-aware:
188
+
189
+ - `failed` means the known failure reproduced
190
+ - `passed` means the matched test executed and did not reproduce
191
+ - `skipped` and `not_run` do not count as reproduction evidence
192
+
187
193
  ## Authoring
188
194
 
189
195
  HTTP suites:
@@ -125,7 +125,7 @@ export async function validateKnownFailureIssues({
125
125
 
126
126
  const summary = buildIssueValidationSummary(entries, globalFindings);
127
127
  return {
128
- schemaVersion: 1,
128
+ schemaVersion: 2,
129
129
  provider: "github",
130
130
  mode: normalizedConfig.mode,
131
131
  checkedAt: new Date(now).toISOString(),
@@ -363,7 +363,15 @@ function collectObservedKnownFailureEntries(document, runArtifact, statusArtifac
363
363
  const observed = checks.get(entry.id) || createObservedCheck(entry);
364
364
  observed.matchedTests += 1;
365
365
  if (test.status === "failed") {
366
+ observed.executedTests += 1;
366
367
  observed.failedTests += 1;
368
+ } else if (test.status === "passed") {
369
+ observed.executedTests += 1;
370
+ observed.passedTests += 1;
371
+ } else if (test.status === "skipped") {
372
+ observed.skippedTests += 1;
373
+ } else if (test.status === "not_run") {
374
+ observed.notRunTests += 1;
367
375
  }
368
376
  checks.set(entry.id, observed);
369
377
  }
@@ -399,7 +407,11 @@ function createObservedCheck(entry) {
399
407
  return {
400
408
  id: entry.id,
401
409
  matchedTests: 0,
410
+ executedTests: 0,
411
+ passedTests: 0,
402
412
  failedTests: 0,
413
+ skippedTests: 0,
414
+ notRunTests: 0,
403
415
  };
404
416
  }
405
417
 
@@ -457,7 +469,12 @@ function buildIssueValidationEntry({ entry, observed, issueData }) {
457
469
  });
458
470
  }
459
471
 
460
- if (issueData?.exists && observed.failedTests === 0 && observed.matchedTests > 0) {
472
+ if (
473
+ issueData?.exists &&
474
+ observed.executedTests > 0 &&
475
+ observed.failedTests === 0 &&
476
+ observed.passedTests > 0
477
+ ) {
461
478
  if (normalizedIssueState === "open") {
462
479
  findings.push({
463
480
  code: "open_not_reproduced",
@@ -479,7 +496,11 @@ function buildIssueValidationEntry({ entry, observed, issueData }) {
479
496
  issue: entry.issue,
480
497
  observed: {
481
498
  matchedTests: observed.matchedTests,
499
+ executedTests: observed.executedTests,
500
+ passedTests: observed.passedTests,
482
501
  failedTests: observed.failedTests,
502
+ skippedTests: observed.skippedTests,
503
+ notRunTests: observed.notRunTests,
483
504
  reproduced: observed.failedTests > 0,
484
505
  },
485
506
  github: issueData
@@ -510,8 +531,23 @@ function resolveIssueValidationStatus(issueData, observed, findings) {
510
531
  const normalizedState = normalizeIssueState(issueData.state);
511
532
  if (observed.failedTests > 0 && normalizedState === "closed") return "closed_but_failing";
512
533
  if (observed.failedTests > 0 && normalizedState === "open") return "open_and_failing";
513
- if (observed.matchedTests > 0 && normalizedState === "open") return "open_not_reproduced";
514
- if (observed.matchedTests > 0 && normalizedState === "closed") return "closed_not_reproduced";
534
+ if (observed.executedTests === 0 && observed.matchedTests > 0) return "not_executed";
535
+ if (
536
+ observed.executedTests > 0 &&
537
+ observed.failedTests === 0 &&
538
+ observed.passedTests > 0 &&
539
+ normalizedState === "open"
540
+ ) {
541
+ return "open_not_reproduced";
542
+ }
543
+ if (
544
+ observed.executedTests > 0 &&
545
+ observed.failedTests === 0 &&
546
+ observed.passedTests > 0 &&
547
+ normalizedState === "closed"
548
+ ) {
549
+ return "closed_not_reproduced";
550
+ }
515
551
  if (findings.length > 0) return "metadata_mismatch";
516
552
  return "not_observed";
517
553
  }
@@ -279,6 +279,196 @@ describe("known failures GitHub validation", () => {
279
279
  expect(result.summary.errors).toBe(0);
280
280
  expect(result.summary.warnings).toBeGreaterThan(0);
281
281
  expect(shouldFailKnownFailureIssueValidation(result)).toBe(false);
282
+ expect(result.entries[0].observed).toMatchObject({
283
+ matchedTests: 1,
284
+ executedTests: 1,
285
+ passedTests: 1,
286
+ failedTests: 0,
287
+ skippedTests: 0,
288
+ notRunTests: 0,
289
+ reproduced: false,
290
+ });
291
+ });
292
+
293
+ it("does not treat skipped or not_run files as not reproduced", async () => {
294
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "testkit-gh-not-executed-"));
295
+ tempDirs.push(tempDir);
296
+ const document = normalizeKnownFailuresDocument({
297
+ schemaVersion: 1,
298
+ issueRepo: "acme/repo",
299
+ entries: [
300
+ {
301
+ id: "bad-message",
302
+ title: "Bad message bug",
303
+ classification: "product_bug",
304
+ state: "open",
305
+ issue: {
306
+ repo: "acme/repo",
307
+ number: 12,
308
+ url: "https://github.com/acme/repo/issues/12",
309
+ },
310
+ description: "Wrong message",
311
+ whyFailing: "Payload is wrong",
312
+ lastReviewedAt: "2026-04-27",
313
+ matches: [
314
+ {
315
+ service: "api",
316
+ type: "int",
317
+ path: "src/api/routes/__testkit__/failing.int.testkit.ts",
318
+ },
319
+ {
320
+ service: "api",
321
+ type: "int",
322
+ path: "src/api/routes/__testkit__/blocked.int.testkit.ts",
323
+ },
324
+ ],
325
+ },
326
+ ],
327
+ });
328
+
329
+ const result = await validateKnownFailureIssues({
330
+ productDir: tempDir,
331
+ document,
332
+ statusArtifact: {
333
+ tests: [
334
+ {
335
+ service: "api",
336
+ type: "int",
337
+ path: "src/api/routes/__testkit__/failing.int.testkit.ts",
338
+ status: "skipped",
339
+ },
340
+ {
341
+ service: "api",
342
+ type: "int",
343
+ path: "src/api/routes/__testkit__/blocked.int.testkit.ts",
344
+ status: "not_run",
345
+ },
346
+ ],
347
+ },
348
+ config: {
349
+ provider: "github",
350
+ mode: "warn",
351
+ },
352
+ transport: {
353
+ async fetchRepoIssues(repo, numbers) {
354
+ const map = new Map();
355
+ map.set(numbers[0], {
356
+ repo,
357
+ number: numbers[0],
358
+ exists: true,
359
+ title: "Bad message bug",
360
+ state: "OPEN",
361
+ url: `https://github.com/${repo}/issues/${numbers[0]}`,
362
+ checkedAt: "2026-04-27T00:00:00.000Z",
363
+ source: "github",
364
+ });
365
+ return map;
366
+ },
367
+ },
368
+ });
369
+
370
+ expect(result.summary.byCode.open_not_reproduced).toBeUndefined();
371
+ expect(result.entries[0].findings).toEqual([]);
372
+ expect(result.entries[0].status).toBe("not_executed");
373
+ expect(result.entries[0].observed).toMatchObject({
374
+ matchedTests: 2,
375
+ executedTests: 0,
376
+ passedTests: 0,
377
+ failedTests: 0,
378
+ skippedTests: 1,
379
+ notRunTests: 1,
380
+ reproduced: false,
381
+ });
382
+ });
383
+
384
+ it("still treats mixed passed and skipped execution as not reproduced", async () => {
385
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "testkit-gh-mixed-execution-"));
386
+ tempDirs.push(tempDir);
387
+ const document = normalizeKnownFailuresDocument({
388
+ schemaVersion: 1,
389
+ issueRepo: "acme/repo",
390
+ entries: [
391
+ {
392
+ id: "bad-message",
393
+ title: "Bad message bug",
394
+ classification: "product_bug",
395
+ state: "open",
396
+ issue: {
397
+ repo: "acme/repo",
398
+ number: 12,
399
+ url: "https://github.com/acme/repo/issues/12",
400
+ },
401
+ description: "Wrong message",
402
+ whyFailing: "Payload is wrong",
403
+ lastReviewedAt: "2026-04-27",
404
+ matches: [
405
+ {
406
+ service: "api",
407
+ type: "int",
408
+ path: "src/api/routes/__testkit__/passed.int.testkit.ts",
409
+ },
410
+ {
411
+ service: "api",
412
+ type: "int",
413
+ path: "src/api/routes/__testkit__/skipped.int.testkit.ts",
414
+ },
415
+ ],
416
+ },
417
+ ],
418
+ });
419
+
420
+ const result = await validateKnownFailureIssues({
421
+ productDir: tempDir,
422
+ document,
423
+ statusArtifact: {
424
+ tests: [
425
+ {
426
+ service: "api",
427
+ type: "int",
428
+ path: "src/api/routes/__testkit__/passed.int.testkit.ts",
429
+ status: "passed",
430
+ },
431
+ {
432
+ service: "api",
433
+ type: "int",
434
+ path: "src/api/routes/__testkit__/skipped.int.testkit.ts",
435
+ status: "skipped",
436
+ },
437
+ ],
438
+ },
439
+ config: {
440
+ provider: "github",
441
+ mode: "warn",
442
+ },
443
+ transport: {
444
+ async fetchRepoIssues(repo, numbers) {
445
+ const map = new Map();
446
+ map.set(numbers[0], {
447
+ repo,
448
+ number: numbers[0],
449
+ exists: true,
450
+ title: "Bad message bug",
451
+ state: "OPEN",
452
+ url: `https://github.com/${repo}/issues/${numbers[0]}`,
453
+ checkedAt: "2026-04-27T00:00:00.000Z",
454
+ source: "github",
455
+ });
456
+ return map;
457
+ },
458
+ },
459
+ });
460
+
461
+ expect(result.summary.byCode.open_not_reproduced).toBe(1);
462
+ expect(result.entries[0].status).toBe("open_not_reproduced");
463
+ expect(result.entries[0].observed).toMatchObject({
464
+ matchedTests: 2,
465
+ executedTests: 1,
466
+ passedTests: 1,
467
+ failedTests: 0,
468
+ skippedTests: 1,
469
+ notRunTests: 0,
470
+ reproduced: false,
471
+ });
282
472
  });
283
473
 
284
474
  it("falls back to warning when validation is unavailable", async () => {
@@ -72,7 +72,11 @@ export interface KnownFailureIssueValidationEntry {
72
72
  issue: KnownFailureIssueRef;
73
73
  observed: {
74
74
  matchedTests: number;
75
+ executedTests: number;
76
+ passedTests: number;
75
77
  failedTests: number;
78
+ skippedTests: number;
79
+ notRunTests: number;
76
80
  reproduced: boolean;
77
81
  };
78
82
  github: {
@@ -88,7 +92,7 @@ export interface KnownFailureIssueValidationEntry {
88
92
  }
89
93
 
90
94
  export interface KnownFailureIssueValidationResult {
91
- schemaVersion: 1;
95
+ schemaVersion: 2;
92
96
  provider: "github";
93
97
  mode: "off" | "warn" | "error";
94
98
  checkedAt: string;
@@ -78,7 +78,7 @@ export function buildStatusArtifact({
78
78
  scope.serviceFilter === null;
79
79
 
80
80
  return {
81
- schemaVersion: 5,
81
+ schemaVersion: 6,
82
82
  source: "testkit",
83
83
  notice: "Generated file. Do not edit manually.",
84
84
  product: {
@@ -127,7 +127,7 @@ export function buildRunArtifact({
127
127
  const dbBackend = summarizeDbBackend(results);
128
128
 
129
129
  return {
130
- schemaVersion: 5,
130
+ schemaVersion: 6,
131
131
  source: "testkit",
132
132
  generatedAt: new Date(finishedAt).toISOString(),
133
133
  product: {
@@ -78,7 +78,7 @@ describe("runner reporting", () => {
78
78
  });
79
79
 
80
80
  expect(artifact.product.name).toBe("my-product");
81
- expect(artifact.schemaVersion).toBe(5);
81
+ expect(artifact.schemaVersion).toBe(6);
82
82
  expect(artifact.run).toMatchObject({
83
83
  workers: 2,
84
84
  fileTimeoutSeconds: 60,
@@ -149,7 +149,7 @@ describe("runner reporting", () => {
149
149
  });
150
150
 
151
151
  expect(status).toEqual({
152
- schemaVersion: 5,
152
+ schemaVersion: 6,
153
153
  source: "testkit",
154
154
  notice: "Generated file. Do not edit manually.",
155
155
  product: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "CLI for discovering and running local HTTP, DAL, and Playwright test suites",
5
5
  "type": "module",
6
6
  "types": "./lib/index.d.ts",