@ultimat3/testing 31.31.0 → 31.33.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.31.0",
3
+ "version": "31.33.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.31.0",
51
- "@ultimat3/ai": "31.31.0",
52
- "@ultimat3/auth": "31.31.0",
53
- "@ultimat3/cache": "31.31.0",
54
- "@ultimat3/core": "31.31.0",
55
- "@ultimat3/db": "31.31.0",
56
- "@ultimat3/entity": "31.31.0",
57
- "@ultimat3/http": "31.31.0",
58
- "@ultimat3/i18n": "31.31.0",
59
- "@ultimat3/jobs": "31.31.0",
60
- "@ultimat3/mail": "31.31.0",
61
- "@ultimat3/notify": "31.31.0",
62
- "@ultimat3/policy": "31.31.0",
63
- "@ultimat3/pwa": "31.31.0",
64
- "@ultimat3/query": "31.31.0",
65
- "@ultimat3/realtime": "31.31.0",
66
- "@ultimat3/render": "31.31.0",
67
- "@ultimat3/schema": "31.31.0",
68
- "@ultimat3/scraping": "31.31.0",
69
- "@ultimat3/seo": "31.31.0",
70
- "@ultimat3/time": "31.31.0"
50
+ "@ultimat3/action": "31.33.0",
51
+ "@ultimat3/ai": "31.33.0",
52
+ "@ultimat3/auth": "31.33.0",
53
+ "@ultimat3/cache": "31.33.0",
54
+ "@ultimat3/core": "31.33.0",
55
+ "@ultimat3/db": "31.33.0",
56
+ "@ultimat3/entity": "31.33.0",
57
+ "@ultimat3/http": "31.33.0",
58
+ "@ultimat3/i18n": "31.33.0",
59
+ "@ultimat3/jobs": "31.33.0",
60
+ "@ultimat3/mail": "31.33.0",
61
+ "@ultimat3/notify": "31.33.0",
62
+ "@ultimat3/policy": "31.33.0",
63
+ "@ultimat3/pwa": "31.33.0",
64
+ "@ultimat3/query": "31.33.0",
65
+ "@ultimat3/realtime": "31.33.0",
66
+ "@ultimat3/render": "31.33.0",
67
+ "@ultimat3/schema": "31.33.0",
68
+ "@ultimat3/scraping": "31.33.0",
69
+ "@ultimat3/seo": "31.33.0",
70
+ "@ultimat3/time": "31.33.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "solid-js": "^1.9.18"
@@ -1,11 +1,13 @@
1
1
  // One responsibility: `navigator.onLine` reads `false` from a document's FIRST script while the
2
2
  // session's offline switch is thrown, and reads `true` again — with the `online` event a page
3
- // reconnects on — when it goes back. `Network.emulateNetworkConditions` cuts the NETWORK for a
4
- // document created under the switch but, measured on Chrome 150, never tells it so: a reload under
5
- // the switch read `navigator.onLine === true` at its first script every time, COOP or not, still
6
- // read `true` a second later, and got no `online` event when the switch went back.
7
- // `Network.overrideNetworkState` changed nothing. The dummy's page boot asks at its first script
8
- // and replayed its outbox with a real POST under the cut (`offline-like.e2e.test.ts`, two attempts).
3
+ // reconnects on — when it goes back.
4
+ //
5
+ // `Network.emulateNetworkConditions` cuts the NETWORK for a document created under the switch but,
6
+ // measured on Chrome 150, never tells it so: a reload under the switch read
7
+ // `navigator.onLine === true` at its first script every time, COOP or not, still read `true` a second later, and got no
8
+ // `online` event when the switch went back. `Network.overrideNetworkState` changed nothing. The
9
+ // dummy's page boot asks at its first script and replayed its outbox with a real POST under the cut
10
+ // (`offline-like.e2e.test.ts`, two attempts).
9
11
  //
10
12
  // The override is an OWN property on `navigator`, so the real getter on `Navigator.prototype` is one
11
13
  // `delete` away. A document Chrome DID tell (it saw `offline`) gets Chrome's own `online` event on
@@ -1,6 +1,7 @@
1
1
  // What a FAILED test carries beside its own message: under e2e, the spawned app's last log lines.
2
2
  // The app's log was shown only when it failed to boot, so a live-path bug — a fanout that dropped a
3
3
  // change, a 500 behind a page — failed with a browser assertion and nothing from the server.
4
+ //
4
5
  // Held on `globalThis` under one `Symbol.for` key: the e2e preload and a test file may each hold
5
6
  // their own copy of this module, as `e2e-browser-handle.ts` already explains.
6
7
 
@@ -4,7 +4,7 @@
4
4
  // wrong key, no `email_verified` — so a sign-in test proves the refusals, not just the happy path.
5
5
 
6
6
  import type { Clock } from '@ultimat3/core';
7
- import { assert, systemClock, timingSafeEqual } from '@ultimat3/core';
7
+ import { assert, systemClock, timingSafeEqual, trimTrailingSlashes } from '@ultimat3/core';
8
8
  import { mockFetch } from './sealed-network';
9
9
 
10
10
  export interface FakeIdpUser {
@@ -72,7 +72,7 @@ export async function fakeIdentityProvider(
72
72
  'fakeIdentityProvider was given no users',
73
73
  'pass users: [{ sub, email }]',
74
74
  );
75
- const issuer = (input.issuer ?? 'https://idp.test').replace(/\/+$/, '');
75
+ const issuer = trimTrailingSlashes(input.issuer ?? 'https://idp.test');
76
76
  const clientId = input.clientId ?? 'fake-client';
77
77
  const clientSecret = random();
78
78
  const clock = input.clock ?? systemClock;
@@ -81,12 +81,15 @@ export const DRIVER_FIXTURE_NAMES = ['budget', 'deploy', 'page', 'signIn'] as co
81
81
  export type DriverFixtureName = (typeof DRIVER_FIXTURE_NAMES)[number];
82
82
 
83
83
  /** What each one is waiting on. `Record` over the name union, so the two lists cannot drift. */
84
- export const DRIVER_FIXTURE_NEEDS: Readonly<Record<DriverFixtureName, string>> = {
85
- budget: 'the byte counts a browser run measures off the built output',
86
- deploy: 'a second build to switch the running app to',
87
- page: 'a browser driving the built app',
88
- signIn: 'a browser session against the app’s own sign-in route',
89
- };
84
+ export const DRIVER_FIXTURE_NEEDS: Readonly<Record<DriverFixtureName, string>> = Object.assign(
85
+ Object.create(null),
86
+ {
87
+ budget: 'the byte counts a browser run measures off the built output',
88
+ deploy: 'a second build to switch the running app to',
89
+ page: 'a browser driving the built app',
90
+ signIn: 'a browser session against the app’s own sign-in route',
91
+ } satisfies Readonly<Record<DriverFixtureName, string>>,
92
+ );
90
93
 
91
94
  /**
92
95
  * Declared rather than left out, because the name is the contract. An app that registered its own
@@ -3,6 +3,7 @@
3
3
  // packages are tier 5, so importing it here would be the reverse of the one declared `cli → testing`
4
4
  // edge. A structural seam keeps the direction honest and survives the bundler changing underneath.
5
5
 
6
+ // why: Bun exposes no path API; a chunk's scratch path is joined and named by its basename.
6
7
  import { basename, join } from 'node:path';
7
8
  import { onFileBoundary } from './file-boundary';
8
9
  import { islandCoverageDir, recordChunkMap } from './fixture-island-coverage';
@@ -127,7 +127,7 @@ const MAX_ROUNDS = 100;
127
127
  const LIVE_STATES: ReadonlySet<string> = new Set(['ready', 'delayed', 'running', 'suspended']);
128
128
 
129
129
  const tallyOf = (executions: readonly JobExecution[]): Record<string, StepTally> => {
130
- const steps: Record<string, StepTally> = {};
130
+ const steps: Record<string, StepTally> = Object.create(null);
131
131
  for (const execution of executions) {
132
132
  const replayed = new Set(execution.replayed);
133
133
  for (const step of execution.steps) {
@@ -1,8 +1,10 @@
1
1
  // The `push` fixture: a Web Push runtime for one test, with the push service AND the device played
2
- // in-process. `push.subscribe(actorId)` gives that person a browser — a real P-256 key and auth
3
- // secret, as `PushSubscription.toJSON()` carries — and `push.sent()` is what each device would SHOW:
4
- // every delivery decrypted with that browser's own key, so a test asserts the notification, not
5
- // the bytes. Nothing reaches the network.
2
+ // in-process.
3
+ //
4
+ // `push.subscribe(actorId)` gives that person a browser — a real P-256 key and auth secret, as
5
+ // `PushSubscription.toJSON()` carries — and `push.sent()` is what each device would SHOW: every
6
+ // delivery decrypted with that browser's own key, so a test asserts the notification, not the
7
+ // bytes. Nothing reaches the network.
6
8
 
7
9
  import type { PushReceiverKeys } from '@ultimat3/pwa';
8
10
  import { frozenNow } from './determinism';
package/src/fixtures.ts CHANGED
@@ -94,7 +94,11 @@ export function fixtureSnapshot(): FixtureMap {
94
94
  return Object.fromEntries(registry);
95
95
  }
96
96
 
97
- const CLOSERS: Readonly<Record<string, string>> = { '{': '}', '[': ']', '(': ')' };
97
+ const CLOSERS: Readonly<Record<string, string>> = Object.assign(Object.create(null), {
98
+ '{': '}',
99
+ '[': ']',
100
+ '(': ')',
101
+ } satisfies Readonly<Record<string, string>>);
98
102
  const QUOTES = new Set(['"', "'", '`']);
99
103
 
100
104
  /**
package/src/index.ts CHANGED
@@ -1,11 +1,3 @@
1
- export type {
2
- FixtureBody,
3
- FixtureFactory,
4
- FixtureMap,
5
- FixtureRegistration,
6
- Fixtures,
7
- } from './fixtures';
8
- export { defineFixtures, fixtureSnapshot, fixtureTest, requestedFixtures } from './fixtures';
9
1
  // Public API of @ultimat3/testing. Explicit re-exports: the preload has its own entry point so a
10
2
  // bunfig can load side effects without importing the whole harness.
11
3
 
@@ -272,7 +264,20 @@ export type { ObservedStatement, StatementShape, TestStatements } from './fixtur
272
264
  export { testStatements } from './fixture-statements';
273
265
  export type { SubscribeDriver } from './fixture-subscribe';
274
266
  export { subscribeDriver } from './fixture-subscribe';
275
- export { fixtureTest as test } from './fixtures';
267
+ export type {
268
+ FixtureBody,
269
+ FixtureFactory,
270
+ FixtureMap,
271
+ FixtureRegistration,
272
+ Fixtures,
273
+ } from './fixtures';
274
+ export {
275
+ defineFixtures,
276
+ fixtureSnapshot,
277
+ fixtureTest,
278
+ fixtureTest as test,
279
+ requestedFixtures,
280
+ } from './fixtures';
276
281
  export {
277
282
  DRIVER_FIXTURE_NAMES,
278
283
  FRAMEWORK_FIXTURE_NAMES,
@@ -1,8 +1,10 @@
1
1
  // The island fixture's scratch directories: one per mount, created when the mount needs it and
2
- // removed when the mount ends. A per-PROCESS directory left one behind per `bun test` run, because
3
- // `process.on('exit')` never fires under `bun test` (Bun 1.4.0, measured) — 5,000+ in `/tmp`. A
4
- // KILLED process reaches no cleanup at all, so each directory carries its owner's pid and the next
5
- // process sweeps a dead owner's.
2
+ // removed when the mount ends.
3
+ //
4
+ // A per-PROCESS directory left one behind per `bun test` run, because `process.on('exit')` never
5
+ // fires under `bun test` (Bun 1.4.0, measured) — 5,000+ in `/tmp`. A KILLED process reaches no
6
+ // cleanup at all, so each directory carries its owner's pid and the next process sweeps a dead
7
+ // owner's.
6
8
 
7
9
  // why: Bun has no directory API — a scratch DIRECTORY is made, listed, aged and removed, synchronously
8
10
  import { mkdtempSync, readdirSync, rmSync, statSync } from 'node:fs';
package/src/live-node.ts CHANGED
@@ -1,8 +1,9 @@
1
- // A whole `sync` node and one client socket, in this process, with no port and no network. What
2
- // `x dev --role sync` assembles, minus the listener: the real `LiveQueryRegistry`, the real bridge
3
- // from every `query({ live: true })` the app declared, the real per-subscriber authz, the real
4
- // cursor. The only thing replaced is the socket, and it is replaced by a pair of objects that hand
5
- // each other the same JSON strings a WebSocket would.
1
+ // A whole `sync` node and one client socket, in this process, with no port and no network.
2
+ //
3
+ // What `x dev --role sync` assembles, minus the listener: the real `LiveQueryRegistry`, the real
4
+ // bridge from every `query({ live: true })` the app declared, the real per-subscriber authz, the
5
+ // real cursor. The only thing replaced is the socket, and it is replaced by a pair of objects that
6
+ // hand each other the same JSON strings a WebSocket would.
6
7
  //
7
8
  // Dynamically imported by the `subscribe` fixture, never at module load: a test that never
8
9
  // subscribes must not pull `@ultimat3/realtime` and `@ultimat3/query` into its process, which is
@@ -1,8 +1,10 @@
1
- // Single responsibility: equality over a repository ROW, own properties included. `@ultimat3/entity`
2
- // answers a `.sealed()` column as a server-only property — own, readable by name, not enumerable —
3
- // and `toEqual` walks enumerable properties only: `expect(row).toEqual({ …, password })` fails with
4
- // an EMPTY diff (both sides print alike), and `toEqual(otherRow)` cannot see a wrong secret at all.
5
- // `toEqualRow` compares what the row HOLDS, and names what differs without printing a secret.
1
+ // Single responsibility: equality over a repository ROW, own properties included.
2
+ //
3
+ // `@ultimat3/entity` answers a `.sealed()` column as a server-only property — own, readable by
4
+ // name, not enumerable — and `toEqual` walks enumerable properties only:
5
+ // `expect(row).toEqual({ …, password })` fails with an EMPTY diff (both sides print alike), and
6
+ // `toEqual(otherRow)` cannot see a wrong secret at all. `toEqualRow` compares what the row HOLDS, and names what differs
7
+ // without printing a secret.
6
8
 
7
9
  import { describeValue, renderCauseValue } from '@ultimat3/core';
8
10
  import type { MatcherResult } from './matcher-result';
@@ -1,8 +1,10 @@
1
1
  // One test seam: an empty entity registry for the test that needs one, and the process's own
2
- // registry back afterwards. `entity()` registers at MODULE scope — which is idiomatic, an app
3
- // declares its domain by importing it — so a test asserting on the WHOLE registry inherits every
4
- // entity any earlier file in the same `bun test` process imported, and its premise becomes
5
- // whatever ran before it rather than what it declared.
2
+ // registry back afterwards.
3
+ //
4
+ // `entity()` registers at MODULE scope — which is idiomatic, an app declares its domain by
5
+ // importing it — so a test asserting on the WHOLE registry inherits every entity any earlier file
6
+ // in the same `bun test` process imported, and its premise becomes whatever ran before it rather
7
+ // than what it declared.
6
8
  //
7
9
  // Its OWN entry point (`@ultimat3/testing/registry-isolation`), off the barrel: the value import
8
10
  // below is static because the restore has to be handed back synchronously, so re-exporting this