@yasserkhanorg/e2e-agents 0.5.4 → 0.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ai_mapping.d.ts","sourceRoot":"","sources":["../../src/agent/ai_mapping.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AA2BvD,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAiOD,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,EAC7B,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,QAAQ,EAAE,GAClB,OAAO,CAAC,eAAe,CAAC,CAqN1B"}
1
+ {"version":3,"file":"ai_mapping.d.ts","sourceRoot":"","sources":["../../src/agent/ai_mapping.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AA2BvD,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB;AAiOD,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,EAC7B,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,QAAQ,EAAE,GAClB,OAAO,CAAC,eAAe,CAAC,CAoN1B"}
@@ -371,17 +371,16 @@ async function mapAITestsToFlows(appRoot, testsRoot, config, flows, tests) {
371
371
  matchedTests.add(testPath);
372
372
  }
373
373
  }
374
- // Post-AI exact-name fallback: for any flow still uncovered, if a candidate test
375
- // was matched by exact name (score 999), map it directly regardless of AI confidence.
374
+ // Post-AI exact-name fallback: for any flow still uncovered, search all test paths
375
+ // for a file or directory whose name exactly matches the flow ID. This handles flows
376
+ // whose keywords are all low-signal (e.g. view_user_group_modal) but whose test file
377
+ // is named after the flow and is therefore unambiguous coverage evidence.
378
+ const allNormalizedTests = tests.map((t) => (0, utils_js_1.normalizePath)(t.path)).filter(Boolean);
376
379
  for (const flow of prioritizedFlows) {
377
380
  if (mapped.has(flow.id)) {
378
381
  continue;
379
382
  }
380
- const candidates = candidateSelection.byFlow.get(flow.id);
381
- if (!candidates) {
382
- continue;
383
- }
384
- const exactMatch = Array.from(candidates).find((testPath) => {
383
+ const exactMatch = allNormalizedTests.find((testPath) => {
385
384
  const segments = testPath.split('/');
386
385
  return segments.some((seg) => seg === flow.id || seg.replace(/\.spec\.[tj]sx?$/, '') === flow.id);
387
386
  });
package/dist/cli.js CHANGED
@@ -998,9 +998,22 @@ async function main() {
998
998
  return;
999
999
  }
1000
1000
  if (args.command === 'suggest' || args.command === 'plan') {
1001
- await (0, runner_js_1.runImpact)(config, { apply: args.apply });
1002
1001
  const reportRoot = config.testsRoot || config.path;
1003
1002
  const impactPath = (0, path_1.join)(reportRoot, '.e2e-ai-agents', 'impact.json');
1003
+ try {
1004
+ await (0, runner_js_1.runImpact)(config, { apply: args.apply });
1005
+ }
1006
+ catch (err) {
1007
+ // If impact analysis already ran (e.g. a prior CI step wrote impact.json),
1008
+ // fall back to that data rather than failing the plan step.
1009
+ if ((0, fs_1.existsSync)(impactPath)) {
1010
+ // eslint-disable-next-line no-console
1011
+ console.warn(`Impact re-run failed (${err instanceof Error ? err.message : String(err)}); using existing impact.json.`);
1012
+ }
1013
+ else {
1014
+ throw err;
1015
+ }
1016
+ }
1004
1017
  if (!(0, fs_1.existsSync)(impactPath)) {
1005
1018
  throw new Error(`Impact report not found at ${impactPath}`);
1006
1019
  }
@@ -368,17 +368,16 @@ export async function mapAITestsToFlows(appRoot, testsRoot, config, flows, tests
368
368
  matchedTests.add(testPath);
369
369
  }
370
370
  }
371
- // Post-AI exact-name fallback: for any flow still uncovered, if a candidate test
372
- // was matched by exact name (score 999), map it directly regardless of AI confidence.
371
+ // Post-AI exact-name fallback: for any flow still uncovered, search all test paths
372
+ // for a file or directory whose name exactly matches the flow ID. This handles flows
373
+ // whose keywords are all low-signal (e.g. view_user_group_modal) but whose test file
374
+ // is named after the flow and is therefore unambiguous coverage evidence.
375
+ const allNormalizedTests = tests.map((t) => normalizePath(t.path)).filter(Boolean);
373
376
  for (const flow of prioritizedFlows) {
374
377
  if (mapped.has(flow.id)) {
375
378
  continue;
376
379
  }
377
- const candidates = candidateSelection.byFlow.get(flow.id);
378
- if (!candidates) {
379
- continue;
380
- }
381
- const exactMatch = Array.from(candidates).find((testPath) => {
380
+ const exactMatch = allNormalizedTests.find((testPath) => {
382
381
  const segments = testPath.split('/');
383
382
  return segments.some((seg) => seg === flow.id || seg.replace(/\.spec\.[tj]sx?$/, '') === flow.id);
384
383
  });
package/dist/esm/cli.js CHANGED
@@ -996,9 +996,22 @@ async function main() {
996
996
  return;
997
997
  }
998
998
  if (args.command === 'suggest' || args.command === 'plan') {
999
- await runImpact(config, { apply: args.apply });
1000
999
  const reportRoot = config.testsRoot || config.path;
1001
1000
  const impactPath = join(reportRoot, '.e2e-ai-agents', 'impact.json');
1001
+ try {
1002
+ await runImpact(config, { apply: args.apply });
1003
+ }
1004
+ catch (err) {
1005
+ // If impact analysis already ran (e.g. a prior CI step wrote impact.json),
1006
+ // fall back to that data rather than failing the plan step.
1007
+ if (existsSync(impactPath)) {
1008
+ // eslint-disable-next-line no-console
1009
+ console.warn(`Impact re-run failed (${err instanceof Error ? err.message : String(err)}); using existing impact.json.`);
1010
+ }
1011
+ else {
1012
+ throw err;
1013
+ }
1014
+ }
1002
1015
  if (!existsSync(impactPath)) {
1003
1016
  throw new Error(`Impact report not found at ${impactPath}`);
1004
1017
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasserkhanorg/e2e-agents",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Pluggable LLM provider library for AI-powered test automation. Use Claude, Ollama, or your own LLM. Integrate with Playwright, Jest, or any test framework. MCP server for test agents, cost tracking, and hybrid provider mode.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",