@ultimat3/testing 27.1.0 → 27.2.1
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 +16 -16
- package/src/fixtures.ts +13 -6
- package/src/preload.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/testing",
|
|
3
|
-
"version": "27.1
|
|
3
|
+
"version": "27.2.1",
|
|
4
4
|
"description": "Test harness: cloned template DBs per worker, frozen clock, sealed network, 6 test types",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"test": "bun test"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ultimat3/action": "27.1
|
|
40
|
-
"@ultimat3/cache": "27.1
|
|
41
|
-
"@ultimat3/core": "27.1
|
|
42
|
-
"@ultimat3/db": "27.1
|
|
43
|
-
"@ultimat3/entity": "27.1
|
|
44
|
-
"@ultimat3/http": "27.1
|
|
45
|
-
"@ultimat3/i18n": "27.1
|
|
46
|
-
"@ultimat3/jobs": "27.1
|
|
47
|
-
"@ultimat3/mail": "27.1
|
|
48
|
-
"@ultimat3/policy": "27.1
|
|
49
|
-
"@ultimat3/pwa": "27.1
|
|
50
|
-
"@ultimat3/query": "27.1
|
|
51
|
-
"@ultimat3/realtime": "27.1
|
|
52
|
-
"@ultimat3/render": "27.1
|
|
53
|
-
"@ultimat3/time": "27.1
|
|
39
|
+
"@ultimat3/action": "27.2.1",
|
|
40
|
+
"@ultimat3/cache": "27.2.1",
|
|
41
|
+
"@ultimat3/core": "27.2.1",
|
|
42
|
+
"@ultimat3/db": "27.2.1",
|
|
43
|
+
"@ultimat3/entity": "27.2.1",
|
|
44
|
+
"@ultimat3/http": "27.2.1",
|
|
45
|
+
"@ultimat3/i18n": "27.2.1",
|
|
46
|
+
"@ultimat3/jobs": "27.2.1",
|
|
47
|
+
"@ultimat3/mail": "27.2.1",
|
|
48
|
+
"@ultimat3/policy": "27.2.1",
|
|
49
|
+
"@ultimat3/pwa": "27.2.1",
|
|
50
|
+
"@ultimat3/query": "27.2.1",
|
|
51
|
+
"@ultimat3/realtime": "27.2.1",
|
|
52
|
+
"@ultimat3/render": "27.2.1",
|
|
53
|
+
"@ultimat3/time": "27.2.1"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/fixtures.ts
CHANGED
|
@@ -141,6 +141,13 @@ function patternSegments(source: string, open: number): readonly string[] | unde
|
|
|
141
141
|
return undefined;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Up to the `{` that opens a first-parameter pattern: an optional `async`, then `function` (with
|
|
146
|
+
* its name or `*`) or a method name, then `(` and the brace. An arrow with no parens (`bag =>`), an
|
|
147
|
+
* empty list (`() =>`) and a first parameter that is a plain name (`(bag) =>`) never match.
|
|
148
|
+
*/
|
|
149
|
+
const PATTERN_HEAD = /^\s*(?:async\b\s*)?(?:function\b[^(]*|[A-Za-z_$][\w$]*\s*)?\(\s*\{/;
|
|
150
|
+
|
|
144
151
|
/**
|
|
145
152
|
* The names a body destructures, read from its source.
|
|
146
153
|
*
|
|
@@ -151,12 +158,12 @@ function patternSegments(source: string, open: number): readonly string[] | unde
|
|
|
151
158
|
*/
|
|
152
159
|
export function requestedFixtures(body: (...args: never[]) => unknown): readonly string[] {
|
|
153
160
|
const source = body.toString();
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
//
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
return (patternSegments(source,
|
|
161
|
+
// The pattern is the FIRST PARAMETER, so its `{` is the first thing inside the parameter list's
|
|
162
|
+
// `(`. The first `{` anywhere was read instead, so `() => fn({ seed: 1 })` asked for `seed`:
|
|
163
|
+
// the call's object literal in the BODY was taken for a destructured parameter.
|
|
164
|
+
const head = PATTERN_HEAD.exec(source);
|
|
165
|
+
if (head === null) return [];
|
|
166
|
+
return (patternSegments(source, head[0].length - 1) ?? [])
|
|
160
167
|
.map((part) => (part.split(/[:=]/)[0] ?? '').trim())
|
|
161
168
|
.filter((name) => /^[A-Za-z_$][\w$]*$/.test(name));
|
|
162
169
|
}
|
package/src/preload.ts
CHANGED
|
@@ -50,9 +50,16 @@ installPerTestReset();
|
|
|
50
50
|
// A shared worker only (an isolated file is a fresh registry anyway): the app's
|
|
51
51
|
// `defineApi({ pathStyle })` evaluates once per worker, in whichever file first imports it, and
|
|
52
52
|
// must not be refused because an EARLIER file derived action paths under the default style.
|
|
53
|
+
//
|
|
54
|
+
// And the rate-limit store every declared `rateLimit:` spends from: a file that spent a test
|
|
55
|
+
// actor's bucket left it spent for the next file on the worker, so a "the 31st call is a 429" test
|
|
56
|
+
// was red whenever another file calling that action ran first. Each file starts with full buckets,
|
|
57
|
+
// the store back to one process' memory, as a file run alone would have it.
|
|
53
58
|
if (Bun.env[ISOLATED_ENV] !== '1') {
|
|
54
59
|
const { forgetHandedOutActionPaths } = await import('@ultimat3/action');
|
|
55
60
|
onFileBoundary(forgetHandedOutActionPaths);
|
|
61
|
+
const { resetRateLimitStore } = await import('@ultimat3/http');
|
|
62
|
+
onFileBoundary(resetRateLimitStore);
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
// An app's `.tsx` compiles with the app's JSX factory on the first file, never cached classic.
|