@testspectra/cli 1.0.25 → 1.0.26

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.
@@ -415,7 +415,10 @@ export async function initCommand(options = {}) {
415
415
  for (const e2eDir of featureE2eDirs) {
416
416
  TypeGenerator.writeDeclarationFiles(e2eDir);
417
417
  }
418
- // 8. Generate ARCHITECTURE.md in root documenting the exact generated layout
418
+ const sharedPoLine = `${sharedTestingRelPath}/page-objects`.padEnd(28, " ");
419
+ const sharedStepsLine = `${sharedTestingRelPath}/steps`.padEnd(28, " ");
420
+ const sharedActLine = `${sharedTestingRelPath}/actions`.padEnd(28, " ");
421
+ const sharedFixLine = `${sharedTestingRelPath}/fixtures`.padEnd(28, " ");
419
422
  const archDocContent = `# TestSpectra Enterprise Monorepo Architecture
420
423
 
421
424
  This workspace uses TestSpectra's **"Centralized Configuration, Distributed Implementation"** model for automated cross-platform testing.
@@ -455,10 +458,10 @@ ${featureE2eDirs.map((d) => {
455
458
 
456
459
  \`\`\`
457
460
  ┌──────────────────────────────┐ ┌──────────────────────────────┐
458
- │ shared/testing/page-objects │ │ modules/*/e2e/specs/ │
459
- │ shared/testing/steps │ ───────► │ (Zero-Import Test Cases) │
460
- │ shared/testing/actions │ │ - NavigationBar.goToHome() │
461
- │ shared/testing/fixtures │ │ - Step.loginAsAdmin() │
461
+ │ ${sharedPoLine} │ │ packages/*/e2e/specs/ │
462
+ │ ${sharedStepsLine} │ ───────► │ (Zero-Import Test Cases) │
463
+ │ ${sharedActLine} │ │ - NavigationBar.goToHome() │
464
+ │ ${sharedFixLine} │ │ - Step.loginAsAdmin() │
462
465
  └──────────────────────────────┘ │ - Spectra.dismissBanner() │
463
466
  └──────────────────────────────┘
464
467
  \`\`\`
@@ -19,12 +19,38 @@ export class TypeGenerator {
19
19
  // Look for shared directories in monorepo root
20
20
  let cur = cwd;
21
21
  while (cur !== path.dirname(cur)) {
22
- const sharedTestingPo = path.join(cur, "shared/testing/page-objects");
23
- const sharedPo = path.join(cur, "shared/page-objects");
24
- if (fs.existsSync(sharedTestingPo) && !dirs.includes(sharedTestingPo))
25
- dirs.push(sharedTestingPo);
26
- if (fs.existsSync(sharedPo) && !dirs.includes(sharedPo))
27
- dirs.push(sharedPo);
22
+ const candidates = [
23
+ path.join(cur, "shared/testing/page-objects"),
24
+ path.join(cur, "shared/page-objects"),
25
+ path.join(cur, "packages/core/testing/page-objects"),
26
+ path.join(cur, "packages/shared/testing/page-objects"),
27
+ path.join(cur, "packages/testing/page-objects"),
28
+ path.join(cur, "core/testing/page-objects"),
29
+ ];
30
+ for (const cand of candidates) {
31
+ if (fs.existsSync(cand) && !dirs.includes(cand))
32
+ dirs.push(cand);
33
+ }
34
+ // Also dynamically check tsconfig.json references if in root
35
+ const rootTsConfig = path.join(cur, "tsconfig.json");
36
+ if (fs.existsSync(rootTsConfig)) {
37
+ try {
38
+ const parsed = JSON.parse(fs.readFileSync(rootTsConfig, "utf-8"));
39
+ if (Array.isArray(parsed.references)) {
40
+ for (const ref of parsed.references) {
41
+ if (ref.path) {
42
+ const poPath1 = path.resolve(cur, ref.path, "page-objects");
43
+ const poPath2 = path.resolve(cur, ref.path, "pageobjects");
44
+ if (fs.existsSync(poPath1) && !dirs.includes(poPath1))
45
+ dirs.push(poPath1);
46
+ if (fs.existsSync(poPath2) && !dirs.includes(poPath2))
47
+ dirs.push(poPath2);
48
+ }
49
+ }
50
+ }
51
+ }
52
+ catch { }
53
+ }
28
54
  if (fs.existsSync(path.join(cur, "pnpm-workspace.yaml")) || fs.existsSync(path.join(cur, "nx.json")))
29
55
  break;
30
56
  cur = path.dirname(cur);
@@ -38,12 +64,35 @@ export class TypeGenerator {
38
64
  dirs.push(local);
39
65
  let cur = cwd;
40
66
  while (cur !== path.dirname(cur)) {
41
- const sharedTesting = path.join(cur, "shared/testing", entityType);
42
- const shared = path.join(cur, "shared", entityType);
43
- if (fs.existsSync(sharedTesting) && !dirs.includes(sharedTesting))
44
- dirs.push(sharedTesting);
45
- if (fs.existsSync(shared) && !dirs.includes(shared))
46
- dirs.push(shared);
67
+ const candidates = [
68
+ path.join(cur, "shared/testing", entityType),
69
+ path.join(cur, "shared", entityType),
70
+ path.join(cur, "packages/core/testing", entityType),
71
+ path.join(cur, "packages/shared/testing", entityType),
72
+ path.join(cur, "packages/testing", entityType),
73
+ path.join(cur, "core/testing", entityType),
74
+ ];
75
+ for (const cand of candidates) {
76
+ if (fs.existsSync(cand) && !dirs.includes(cand))
77
+ dirs.push(cand);
78
+ }
79
+ // Also dynamically check tsconfig.json references
80
+ const rootTsConfig = path.join(cur, "tsconfig.json");
81
+ if (fs.existsSync(rootTsConfig)) {
82
+ try {
83
+ const parsed = JSON.parse(fs.readFileSync(rootTsConfig, "utf-8"));
84
+ if (Array.isArray(parsed.references)) {
85
+ for (const ref of parsed.references) {
86
+ if (ref.path) {
87
+ const entPath = path.resolve(cur, ref.path, entityType);
88
+ if (fs.existsSync(entPath) && !dirs.includes(entPath))
89
+ dirs.push(entPath);
90
+ }
91
+ }
92
+ }
93
+ }
94
+ catch { }
95
+ }
47
96
  if (fs.existsSync(path.join(cur, "pnpm-workspace.yaml")) || fs.existsSync(path.join(cur, "nx.json")))
48
97
  break;
49
98
  cur = path.dirname(cur);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testspectra/cli",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "TestSpectra Zero-Config Cross-Platform Test Runner CLI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",