@ultimat3/testing 31.40.1 → 31.41.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/testing",
3
- "version": "31.40.1",
3
+ "version": "31.41.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,27 +47,27 @@
47
47
  "test": "bun test"
48
48
  },
49
49
  "dependencies": {
50
- "@ultimat3/action": "31.40.1",
51
- "@ultimat3/ai": "31.40.1",
52
- "@ultimat3/auth": "31.40.1",
53
- "@ultimat3/cache": "31.40.1",
54
- "@ultimat3/core": "31.40.1",
55
- "@ultimat3/db": "31.40.1",
56
- "@ultimat3/entity": "31.40.1",
57
- "@ultimat3/http": "31.40.1",
58
- "@ultimat3/i18n": "31.40.1",
59
- "@ultimat3/jobs": "31.40.1",
60
- "@ultimat3/mail": "31.40.1",
61
- "@ultimat3/notify": "31.40.1",
62
- "@ultimat3/policy": "31.40.1",
63
- "@ultimat3/pwa": "31.40.1",
64
- "@ultimat3/query": "31.40.1",
65
- "@ultimat3/realtime": "31.40.1",
66
- "@ultimat3/render": "31.40.1",
67
- "@ultimat3/schema": "31.40.1",
68
- "@ultimat3/scraping": "31.40.1",
69
- "@ultimat3/seo": "31.40.1",
70
- "@ultimat3/time": "31.40.1"
50
+ "@ultimat3/action": "31.41.0",
51
+ "@ultimat3/ai": "31.41.0",
52
+ "@ultimat3/auth": "31.41.0",
53
+ "@ultimat3/cache": "31.41.0",
54
+ "@ultimat3/core": "31.41.0",
55
+ "@ultimat3/db": "31.41.0",
56
+ "@ultimat3/entity": "31.41.0",
57
+ "@ultimat3/http": "31.41.0",
58
+ "@ultimat3/i18n": "31.41.0",
59
+ "@ultimat3/jobs": "31.41.0",
60
+ "@ultimat3/mail": "31.41.0",
61
+ "@ultimat3/notify": "31.41.0",
62
+ "@ultimat3/policy": "31.41.0",
63
+ "@ultimat3/pwa": "31.41.0",
64
+ "@ultimat3/query": "31.41.0",
65
+ "@ultimat3/realtime": "31.41.0",
66
+ "@ultimat3/render": "31.41.0",
67
+ "@ultimat3/schema": "31.41.0",
68
+ "@ultimat3/scraping": "31.41.0",
69
+ "@ultimat3/seo": "31.41.0",
70
+ "@ultimat3/time": "31.41.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "solid-js": "^1.9.18"
@@ -12,6 +12,7 @@ import type { LaunchedBrowser } from '@ultimat3/scraping/cdp';
12
12
  import {
13
13
  CdpBrowserMissingError,
14
14
  CHROME_CANDIDATES,
15
+ CHROME_RESTRICTED_PORTS,
15
16
  findChrome,
16
17
  LAUNCH_BUDGET_MS,
17
18
  launchChrome,
@@ -134,7 +135,12 @@ async function openLaunched(
134
135
  timeoutMs: number,
135
136
  acceptLanguage: string | undefined,
136
137
  ): Promise<E2eBrowser> {
137
- const launched = await launchChrome({ executable, timeoutMs });
138
+ // The e2e browser loads pages its own tests serve on `port: 0`, which may be a port Chrome refuses.
139
+ const launched = await launchChrome({
140
+ executable,
141
+ timeoutMs,
142
+ allowedPorts: CHROME_RESTRICTED_PORTS,
143
+ });
138
144
  const { connection } = launched;
139
145
  try {
140
146
  const session = await cdpE2eSession({
@@ -90,7 +90,12 @@ export interface MountIslandOptions {
90
90
  * one — `return render(…)`), then hands the process its globals back. Both, in that order.
91
91
  */
92
92
  export interface MountedIsland extends Disposable {
93
- /** The chunk's source, for asserting on what did or did not reach the browser. */
93
+ /**
94
+ * The SHIPPED chunk's source — what did or did not reach the browser, and its minified size.
95
+ * Under the gate's coverage run (`ISLAND_COVERAGE_ENV`) the chunk that RUNS is a second,
96
+ * unminified build for the source map; `code` is still the shipped one, so a byte ceiling reads
97
+ * the same under `bun test` and `x verify`.
98
+ */
94
99
  readonly code: string;
95
100
  /** The host element `mount` was given. */
96
101
  readonly el: FakeElement;
@@ -231,6 +236,15 @@ export async function mountIsland(options: MountIslandOptions): Promise<MountedI
231
236
  );
232
237
  }
233
238
 
239
+ // What `code` answers is what ships: a coverage build keeps whitespace for its map, and an app's
240
+ // size ceiling read it as the chunk (31.27–31.40: green under `bun test`, red in `x verify`).
241
+ const shipped =
242
+ coverage === undefined
243
+ ? chunk.code
244
+ : ((await options.build(options.root, { only: options.file })).chunks.find(
245
+ (each) => each.file === options.file,
246
+ )?.code ?? chunk.code);
247
+
234
248
  const { documentElement, globals, resizeObservers } = createIslandDocument();
235
249
  const restore = installGlobals({ ...globals, ...options.globals });
236
250
  let dir: string | undefined;
@@ -298,7 +312,7 @@ export async function mountIsland(options: MountIslandOptions): Promise<MountedI
298
312
  const resolve = (target: string | FakeElement | null | undefined): FakeElement | null =>
299
313
  typeof target === 'string' ? el.querySelector(target) : (target ?? null);
300
314
  return {
301
- code: chunk.code,
315
+ code: shipped,
302
316
  el,
303
317
  documentElement,
304
318
  find: (selector) => el.querySelector(selector),
@@ -38,10 +38,10 @@ export interface IslandStateSuiteOptions extends IslandStateMountOptions, TestOp
38
38
  export const ISLAND_MOUNT_TIMEOUT_MS = 60_000;
39
39
 
40
40
  /**
41
- * Bundles already built in this process, per builder, by `<root>\0<island>`. A file with three
42
- * states used to build its island three times; the source cannot change between two mounts of one
43
- * test run, so the second is a lookup. A build that REJECTS is forgotten, so the next mount
44
- * reports its own failure rather than a cached one.
41
+ * Bundles already built in this process, per builder, by `<root>\0<island>\0<covered|shipped>`.
42
+ * A file with three states used to build its island three times; the source cannot change between
43
+ * two mounts of one test run, so the second is a lookup. A build that REJECTS is forgotten, so the
44
+ * next mount reports its own failure rather than a cached one.
45
45
  */
46
46
  const bundles = new WeakMap<IslandBuilder, Map<string, Promise<IslandBundleLike>>>();
47
47
 
@@ -50,7 +50,9 @@ const buildOnce =
50
50
  (root, options) => {
51
51
  const built = bundles.get(build) ?? new Map<string, Promise<IslandBundleLike>>();
52
52
  bundles.set(build, built);
53
- const key = `${root}\0${options?.only ?? ''}`;
53
+ // The coverage build and the shipped one are two bundles of one island (`mountIsland`).
54
+ const flavour = options?.coverage === true ? 'covered' : 'shipped';
55
+ const key = `${root}\0${options?.only ?? ''}\0${flavour}`;
54
56
  const known = built.get(key);
55
57
  if (known !== undefined) return known;
56
58
  const pending = build(root, options);
@@ -211,7 +211,9 @@ export function installRegistryLeakGuard(): void {
211
211
  // them. The framework repository's own suites keep the exact restore: many of them lean on an
212
212
  // EMPTY permission set (no validation), and a test body's declaration must not switch it on for
213
213
  // every later file. Tasks go back EXACTLY everywhere: one a test body registered must not fire
214
- // in the next file's scheduler round.
214
+ // in the next file's scheduler round. Jobs go back exactly in the framework repository only: in
215
+ // an app, a job a lazily imported module declared is every later file's (it never declares
216
+ // again), and an exact restore left its queue holding a job "nothing registered" (31.25–31.40).
215
217
  const live = captureProcessRegistries();
216
218
  const merged = inApp ? mergeSnapshots(live, current.snapshot) : current.snapshot;
217
219
  // Locales likewise, in one case: the file's baseline still held the framework's pristine
@@ -228,7 +230,7 @@ export function installRegistryLeakGuard(): void {
228
230
  ...merged,
229
231
  locales: declaredLazily ? live.locales : current.snapshot.locales,
230
232
  tasks: current.snapshot.tasks,
231
- jobs: current.snapshot.jobs,
233
+ jobs: inApp ? merged.jobs : current.snapshot.jobs,
232
234
  };
233
235
  restoreProcessRegistries(restored);
234
236
  // To the PRELOAD's notes, never the body's start: a store is noted as its driver is built,