@ultimat3/testing 31.5.0 → 31.6.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.
Files changed (2) hide show
  1. package/package.json +22 -22
  2. package/src/e2e-errors.ts +30 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/testing",
3
- "version": "31.5.0",
3
+ "version": "31.6.0",
4
4
  "description": "Test harness: cloned template DBs per worker, frozen clock, sealed network, 6 test types",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -47,26 +47,26 @@
47
47
  "test": "bun test"
48
48
  },
49
49
  "dependencies": {
50
- "@ultimat3/action": "31.5.0",
51
- "@ultimat3/ai": "31.5.0",
52
- "@ultimat3/auth": "31.5.0",
53
- "@ultimat3/cache": "31.5.0",
54
- "@ultimat3/core": "31.5.0",
55
- "@ultimat3/db": "31.5.0",
56
- "@ultimat3/entity": "31.5.0",
57
- "@ultimat3/http": "31.5.0",
58
- "@ultimat3/i18n": "31.5.0",
59
- "@ultimat3/jobs": "31.5.0",
60
- "@ultimat3/mail": "31.5.0",
61
- "@ultimat3/notify": "31.5.0",
62
- "@ultimat3/policy": "31.5.0",
63
- "@ultimat3/pwa": "31.5.0",
64
- "@ultimat3/query": "31.5.0",
65
- "@ultimat3/realtime": "31.5.0",
66
- "@ultimat3/render": "31.5.0",
67
- "@ultimat3/schema": "31.5.0",
68
- "@ultimat3/scraping": "31.5.0",
69
- "@ultimat3/seo": "31.5.0",
70
- "@ultimat3/time": "31.5.0"
50
+ "@ultimat3/action": "31.6.0",
51
+ "@ultimat3/ai": "31.6.0",
52
+ "@ultimat3/auth": "31.6.0",
53
+ "@ultimat3/cache": "31.6.0",
54
+ "@ultimat3/core": "31.6.0",
55
+ "@ultimat3/db": "31.6.0",
56
+ "@ultimat3/entity": "31.6.0",
57
+ "@ultimat3/http": "31.6.0",
58
+ "@ultimat3/i18n": "31.6.0",
59
+ "@ultimat3/jobs": "31.6.0",
60
+ "@ultimat3/mail": "31.6.0",
61
+ "@ultimat3/notify": "31.6.0",
62
+ "@ultimat3/policy": "31.6.0",
63
+ "@ultimat3/pwa": "31.6.0",
64
+ "@ultimat3/query": "31.6.0",
65
+ "@ultimat3/realtime": "31.6.0",
66
+ "@ultimat3/render": "31.6.0",
67
+ "@ultimat3/schema": "31.6.0",
68
+ "@ultimat3/scraping": "31.6.0",
69
+ "@ultimat3/seo": "31.6.0",
70
+ "@ultimat3/time": "31.6.0"
71
71
  }
72
72
  }
package/src/e2e-errors.ts CHANGED
@@ -115,23 +115,52 @@ export class E2eServiceWorkerAbsentError extends UltimateError {
115
115
  }
116
116
  }
117
117
 
118
+ /** One coded finding a framework process printed, in core's 3-line contract format. */
119
+ export interface InnerFinding {
120
+ readonly code: string;
121
+ readonly cause: string;
122
+ readonly fix: string;
123
+ }
124
+
125
+ const CONTRACT_FINDING = /^\s*(X_[A-Z0-9_]+)\b[^\n]*\n\s+cause: ([^\n]*)\n\s+fix:\s+([^\n]*)/m;
126
+
127
+ /** The FIRST coded finding in a process's output: the one the run stopped on. */
128
+ function innerFinding(output: string): InnerFinding | undefined {
129
+ const match = CONTRACT_FINDING.exec(output);
130
+ if (match === null) return undefined;
131
+ const [, code = '', cause = '', fix = ''] = match;
132
+ return { code, cause: cause.trim(), fix: fix.trim() };
133
+ }
134
+
118
135
  /**
119
136
  * The app an e2e run spawns (`e2e-app.ts`) did not come up: its reset, its seed, or its boot. The
120
137
  * cause carries that process's own output, rendered, because it is the only place the reason is.
138
+ * When that output holds a coded finding — a seed row its entity refuses is `X_INVARIANT_VIOLATED`
139
+ * — its code leads the cause and its fix is this error's: the code stays `X_E2E_APP_FAILED`
140
+ * (shipped codes never change), and `inner` carries the lifted one for a reader that branches.
121
141
  */
122
142
  export class E2eAppFailedError extends UltimateError {
143
+ readonly inner: InnerFinding | undefined;
144
+
123
145
  constructor(input: {
124
146
  readonly step: string;
125
147
  readonly output: string;
126
148
  /** A literal, for the one step `x dev` cannot diagnose: there being no `x` to run. */
127
149
  readonly fix?: string | undefined;
128
150
  }) {
151
+ const inner = innerFinding(input.output);
152
+ const lifted =
153
+ inner === undefined
154
+ ? ''
155
+ : ` with ${inner.code}: ${renderCauseValue(inner.cause)}; its output`;
129
156
  super({
130
157
  code: 'X_E2E_APP_FAILED',
131
- cause: `${renderCauseValue(input.step)} failed for the e2e app: ${renderCauseValue(input.output)}`,
158
+ cause: `${renderCauseValue(input.step)} failed for the e2e app${lifted}: ${renderCauseValue(input.output)}`,
132
159
  fix:
133
160
  input.fix ??
161
+ inner?.fix ??
134
162
  'x dev --json # boot the same app by hand and read why it would not start; the e2e run used a throwaway ULTIMATE_STATE_DIR, so your own .x is untouched',
135
163
  });
164
+ this.inner = inner;
136
165
  }
137
166
  }