@e2e-dev/web 0.15.1 → 0.15.2-nightly-20261016073603

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/dist/.build.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.15.1"}
1
+ {"version":"0.15.2-nightly-20261016073603"}
package/dist/engine.js CHANGED
@@ -36,8 +36,8 @@ export function web(options = {}) {
36
36
  if (provider !== undefined && options.connect !== undefined) {
37
37
  throw new ConfigurationError('INVALID_CONFIG', `web({ browser, connect }) names two browser sources; browser provider "${provider.name}" leases its own browsers, so remove connect`);
38
38
  }
39
- if (isRecord(options.connect))
40
- rejectUnknownKeys('web({ connect })', options.connect, ['cdpEndpoint', 'reconnectEndpoint']);
39
+ if (options.connect !== undefined)
40
+ validateConnect(options.connect);
41
41
  if (options.connect !== undefined && typeof options.browser === 'string' && options.browser !== 'chromium') {
42
42
  throw new ConfigurationError('INVALID_CONFIG', `web({ connect }) requires the chromium browser; CDP attach is chromium-only, got "${options.browser}"`);
43
43
  }
@@ -59,9 +59,6 @@ export function web(options = {}) {
59
59
  if (options.screencast !== undefined)
60
60
  validateScreencast(options.screencast);
61
61
  const reconnecting = options.connect?.reconnectEndpoint !== undefined;
62
- if (reconnecting && typeof options.connect?.reconnectEndpoint !== 'function') {
63
- throw new ConfigurationError('INVALID_CONFIG', 'connect.reconnectEndpoint must be a function');
64
- }
65
62
  // A per-attempt lease rides the same persistent context as `reconnectEndpoint`, with the same limits.
66
63
  const recoverable = reconnecting || provider?.scope === 'attempt';
67
64
  const mode = provider === undefined ? 'connect.reconnectEndpoint' : `browser provider "${provider.name}" with scope "attempt"`;
@@ -155,6 +152,38 @@ function persistentContextLimit(what, mode, leased) {
155
152
  function isRecord(value) {
156
153
  return typeof value === 'object' && value !== null && !Array.isArray(value);
157
154
  }
155
+ /** Names a value's kind for a config error without echoing it: a CDP URL can carry a session token. */
156
+ function kindOf(value) {
157
+ if (value === null)
158
+ return 'null';
159
+ if (Array.isArray(value))
160
+ return 'an array';
161
+ const type = typeof value;
162
+ return type === 'object' ? 'an object' : `a ${type}`;
163
+ }
164
+ /**
165
+ * `cdpEndpoint` is the one resolver every connect mode needs: the shared
166
+ * browser's source at init, and the fresh browser each persistent attempt
167
+ * provisions. Without it the attach would call an undefined resolver, so a
168
+ * config missing it fails here, at load, instead of at worker init or on
169
+ * every attempt with `ENGINE_FAILURE: ... resolve is not a function`.
170
+ */
171
+ function validateConnect(connect) {
172
+ if (!isRecord(connect)) {
173
+ throw new ConfigurationError('INVALID_CONFIG', `web({ connect }) must be a plain object: { cdpEndpoint, reconnectEndpoint? }, got ${kindOf(connect)}`);
174
+ }
175
+ rejectUnknownKeys('web({ connect })', connect, ['cdpEndpoint', 'reconnectEndpoint']);
176
+ const { cdpEndpoint, reconnectEndpoint } = connect;
177
+ if (cdpEndpoint === undefined) {
178
+ throw new ConfigurationError('INVALID_CONFIG', `web({ connect }) requires cdpEndpoint, the resolver that provisions the browser: (signal) => url${reconnectEndpoint === undefined ? '' : '; reconnectEndpoint only reconnects to the browser cdpEndpoint provisioned'}`);
179
+ }
180
+ if (typeof cdpEndpoint !== 'function') {
181
+ throw new ConfigurationError('INVALID_CONFIG', `web({ connect: { cdpEndpoint } }) must be a resolver function (signal) => url, got ${kindOf(cdpEndpoint)}`);
182
+ }
183
+ if (reconnectEndpoint !== undefined && typeof reconnectEndpoint !== 'function') {
184
+ throw new ConfigurationError('INVALID_CONFIG', `web({ connect: { reconnectEndpoint } }) must be a resolver function (signal) => url, got ${kindOf(reconnectEndpoint)}`);
185
+ }
186
+ }
158
187
  /**
159
188
  * Refuses a header the browser could not send, at config load rather than at
160
189
  * the first request: a name outside the token grammar, a value carrying a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e2e-dev/web",
3
- "version": "0.15.1",
3
+ "version": "0.15.2-nightly-20261016073603",
4
4
  "description": "Web engine for e2e agentic end-to-end testing, built on Playwright",
5
5
  "keywords": [
6
6
  "e2e",
@@ -50,11 +50,11 @@
50
50
  "playwright-core": "1.64.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "e2e": ">=0.18.0 <1"
53
+ "e2e": "0.21.2-nightly-20261016073603"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "26.6.2",
57
- "e2e": "0.21.1",
57
+ "e2e": "0.21.2-nightly-20261016073603",
58
58
  "@types/pngjs": "6.0.5",
59
59
  "pngjs": "7.0.0",
60
60
  "typescript": "7.0.2",