@ultimat3/testing 31.42.1 → 31.43.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/determinism.ts +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/testing",
3
- "version": "31.42.1",
3
+ "version": "31.43.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.42.1",
51
- "@ultimat3/ai": "31.42.1",
52
- "@ultimat3/auth": "31.42.1",
53
- "@ultimat3/cache": "31.42.1",
54
- "@ultimat3/core": "31.42.1",
55
- "@ultimat3/db": "31.42.1",
56
- "@ultimat3/entity": "31.42.1",
57
- "@ultimat3/http": "31.42.1",
58
- "@ultimat3/i18n": "31.42.1",
59
- "@ultimat3/jobs": "31.42.1",
60
- "@ultimat3/mail": "31.42.1",
61
- "@ultimat3/notify": "31.42.1",
62
- "@ultimat3/policy": "31.42.1",
63
- "@ultimat3/pwa": "31.42.1",
64
- "@ultimat3/query": "31.42.1",
65
- "@ultimat3/realtime": "31.42.1",
66
- "@ultimat3/render": "31.42.1",
67
- "@ultimat3/schema": "31.42.1",
68
- "@ultimat3/scraping": "31.42.1",
69
- "@ultimat3/seo": "31.42.1",
70
- "@ultimat3/time": "31.42.1"
50
+ "@ultimat3/action": "31.43.0",
51
+ "@ultimat3/ai": "31.43.0",
52
+ "@ultimat3/auth": "31.43.0",
53
+ "@ultimat3/cache": "31.43.0",
54
+ "@ultimat3/core": "31.43.0",
55
+ "@ultimat3/db": "31.43.0",
56
+ "@ultimat3/entity": "31.43.0",
57
+ "@ultimat3/http": "31.43.0",
58
+ "@ultimat3/i18n": "31.43.0",
59
+ "@ultimat3/jobs": "31.43.0",
60
+ "@ultimat3/mail": "31.43.0",
61
+ "@ultimat3/notify": "31.43.0",
62
+ "@ultimat3/policy": "31.43.0",
63
+ "@ultimat3/pwa": "31.43.0",
64
+ "@ultimat3/query": "31.43.0",
65
+ "@ultimat3/realtime": "31.43.0",
66
+ "@ultimat3/render": "31.43.0",
67
+ "@ultimat3/schema": "31.43.0",
68
+ "@ultimat3/scraping": "31.43.0",
69
+ "@ultimat3/seo": "31.43.0",
70
+ "@ultimat3/time": "31.43.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "solid-js": "^1.9.18"
@@ -53,7 +53,7 @@ export function seededUuid(seed: number): () => string {
53
53
  return () => `${hex(8)}-${hex(4)}-4${hex(3)}-a${hex(3)}-${hex(12)}`;
54
54
  }
55
55
 
56
- class FrozenDate extends RealDate {
56
+ class FrozenClassDate extends RealDate {
57
57
  constructor(...args: readonly unknown[]) {
58
58
  if (args.length === 0) {
59
59
  super(frozenAt);
@@ -95,6 +95,17 @@ class FrozenDate extends RealDate {
95
95
  }
96
96
  }
97
97
 
98
+ /**
99
+ * What `globalThis.Date` is while installed. A `class` cannot be called without `new`, so
100
+ * `Date()` — the real one answers the current time's string — threw a TypeError under every test
101
+ * preload. The `apply` trap answers the frozen instant's string, ignoring arguments as the real
102
+ * call does; `new`, the statics, `instanceof` and `extends Date` all fall through to the class.
103
+ * One Proxy for the process, so a snapshot's `date` compares by identity.
104
+ */
105
+ const FrozenDate = new Proxy(FrozenClassDate, {
106
+ apply: (): string => new RealDate(frozenAt).toString(),
107
+ });
108
+
98
109
  export interface DeterminismOptions {
99
110
  readonly seed?: number;
100
111
  readonly now?: string | number;