@ultimat3/testing 31.36.0 → 31.38.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 +22 -22
- package/src/island-state-mount.ts +10 -2
- package/src/per-test-reset.ts +16 -3
- package/src/rerun-registries.ts +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/testing",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.38.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.
|
|
51
|
-
"@ultimat3/ai": "31.
|
|
52
|
-
"@ultimat3/auth": "31.
|
|
53
|
-
"@ultimat3/cache": "31.
|
|
54
|
-
"@ultimat3/core": "31.
|
|
55
|
-
"@ultimat3/db": "31.
|
|
56
|
-
"@ultimat3/entity": "31.
|
|
57
|
-
"@ultimat3/http": "31.
|
|
58
|
-
"@ultimat3/i18n": "31.
|
|
59
|
-
"@ultimat3/jobs": "31.
|
|
60
|
-
"@ultimat3/mail": "31.
|
|
61
|
-
"@ultimat3/notify": "31.
|
|
62
|
-
"@ultimat3/policy": "31.
|
|
63
|
-
"@ultimat3/pwa": "31.
|
|
64
|
-
"@ultimat3/query": "31.
|
|
65
|
-
"@ultimat3/realtime": "31.
|
|
66
|
-
"@ultimat3/render": "31.
|
|
67
|
-
"@ultimat3/schema": "31.
|
|
68
|
-
"@ultimat3/scraping": "31.
|
|
69
|
-
"@ultimat3/seo": "31.
|
|
70
|
-
"@ultimat3/time": "31.
|
|
50
|
+
"@ultimat3/action": "31.38.0",
|
|
51
|
+
"@ultimat3/ai": "31.38.0",
|
|
52
|
+
"@ultimat3/auth": "31.38.0",
|
|
53
|
+
"@ultimat3/cache": "31.38.0",
|
|
54
|
+
"@ultimat3/core": "31.38.0",
|
|
55
|
+
"@ultimat3/db": "31.38.0",
|
|
56
|
+
"@ultimat3/entity": "31.38.0",
|
|
57
|
+
"@ultimat3/http": "31.38.0",
|
|
58
|
+
"@ultimat3/i18n": "31.38.0",
|
|
59
|
+
"@ultimat3/jobs": "31.38.0",
|
|
60
|
+
"@ultimat3/mail": "31.38.0",
|
|
61
|
+
"@ultimat3/notify": "31.38.0",
|
|
62
|
+
"@ultimat3/policy": "31.38.0",
|
|
63
|
+
"@ultimat3/pwa": "31.38.0",
|
|
64
|
+
"@ultimat3/query": "31.38.0",
|
|
65
|
+
"@ultimat3/realtime": "31.38.0",
|
|
66
|
+
"@ultimat3/render": "31.38.0",
|
|
67
|
+
"@ultimat3/schema": "31.38.0",
|
|
68
|
+
"@ultimat3/scraping": "31.38.0",
|
|
69
|
+
"@ultimat3/seo": "31.38.0",
|
|
70
|
+
"@ultimat3/time": "31.38.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"solid-js": "^1.9.18"
|
|
@@ -21,7 +21,14 @@ import { testName } from './test-types';
|
|
|
21
21
|
export type IslandStateMountOptions = Omit<MountIslandOptions, 'file' | 'props'>;
|
|
22
22
|
|
|
23
23
|
/** The suite form's: the mount's own, plus the deadline of the `beforeAll` that runs it. */
|
|
24
|
-
export interface IslandStateSuiteOptions extends IslandStateMountOptions, TestOptions {
|
|
24
|
+
export interface IslandStateSuiteOptions extends IslandStateMountOptions, TestOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Run in the block's own `afterAll`, after the island is disposed: process state the island's
|
|
27
|
+
* modules hold beyond the DOM (a realtime island's page connection, `resetPageRealtime`). The
|
|
28
|
+
* one place a generated island test resets anything — never a raw `afterAll` of its own.
|
|
29
|
+
*/
|
|
30
|
+
readonly teardown?: () => void;
|
|
31
|
+
}
|
|
25
32
|
|
|
26
33
|
/**
|
|
27
34
|
* The deadline a block's mount gets when it names none. The first mount in a file pays the island
|
|
@@ -100,7 +107,7 @@ export function describeIslandState(
|
|
|
100
107
|
options: IslandStateSuiteOptions,
|
|
101
108
|
body: (island: () => MountedIsland) => void,
|
|
102
109
|
): void {
|
|
103
|
-
const { timeoutMs, ...mount } = options;
|
|
110
|
+
const { timeoutMs, teardown, ...mount } = options;
|
|
104
111
|
describe(testName('unit', `the ${manifest.name} island, ${id}`), () => {
|
|
105
112
|
let mounted: MountedIsland | undefined;
|
|
106
113
|
let over = false;
|
|
@@ -116,6 +123,7 @@ export function describeIslandState(
|
|
|
116
123
|
over = true;
|
|
117
124
|
mounted?.[Symbol.dispose]();
|
|
118
125
|
mounted = undefined;
|
|
126
|
+
teardown?.();
|
|
119
127
|
});
|
|
120
128
|
body(() => {
|
|
121
129
|
assert(
|
package/src/per-test-reset.ts
CHANGED
|
@@ -20,13 +20,26 @@ export function loaded(pkg: string, file: string): string | undefined {
|
|
|
20
20
|
const key = `${pkg}/${file}`;
|
|
21
21
|
let path = paths.get(key);
|
|
22
22
|
if (path === undefined) {
|
|
23
|
-
path =
|
|
23
|
+
path = resolvedFrom(pkg)?.replace(/index\.ts$/, file) ?? null;
|
|
24
24
|
paths.set(key, path);
|
|
25
25
|
}
|
|
26
|
-
return path in require.cache ? path : undefined;
|
|
26
|
+
return path !== null && path in require.cache ? path : undefined;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Where `pkg` resolves from this package, or `null` when it does not. A package testing declares no
|
|
31
|
+
* dependency on (`@ultimat3/flags`) is unresolvable from here in an app's isolated install, and one
|
|
32
|
+
* this process cannot resolve here is one it did not load through here: absent, never a throw.
|
|
33
|
+
*/
|
|
34
|
+
function resolvedFrom(pkg: string): string | null {
|
|
35
|
+
try {
|
|
36
|
+
return Bun.resolveSync(pkg, import.meta.dir);
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const paths = new Map<string, string | null>();
|
|
30
43
|
|
|
31
44
|
/**
|
|
32
45
|
* Before each test: a fresh DEFAULT event bus and the DEFAULT rate-limit buckets emptied — each
|
package/src/rerun-registries.ts
CHANGED
|
@@ -111,6 +111,14 @@ interface LayoutModule {
|
|
|
111
111
|
readonly layoutFor: typeof layoutFor;
|
|
112
112
|
readonly restoreLayouts: typeof restoreLayouts;
|
|
113
113
|
}
|
|
114
|
+
/** `@ultimat3/flags`' registry, by shape: testing declares no dependency on flags. */
|
|
115
|
+
interface FlagEntry {
|
|
116
|
+
readonly key: string;
|
|
117
|
+
}
|
|
118
|
+
interface FlagModule {
|
|
119
|
+
readonly allFlags: () => readonly FlagEntry[];
|
|
120
|
+
readonly restoreFlags: (entries: readonly FlagEntry[]) => void;
|
|
121
|
+
}
|
|
114
122
|
interface OAuthModule {
|
|
115
123
|
readonly registeredOAuthProviders: typeof registeredOAuthProviders;
|
|
116
124
|
readonly restoreOAuthProviders: typeof restoreOAuthProviders;
|
|
@@ -196,6 +204,12 @@ export function frameworkDeclarationRegistries(): readonly DeclarationRegistry[]
|
|
|
196
204
|
}
|
|
197
205
|
const layouts = moduleOf<LayoutModule>('@ultimat3/mail', 'layout.ts');
|
|
198
206
|
if (layouts !== undefined) registries.push(layoutRegistry(layouts));
|
|
207
|
+
const flags = moduleOf<FlagModule>('@ultimat3/flags', 'registry.ts');
|
|
208
|
+
if (flags !== undefined) {
|
|
209
|
+
registries.push(
|
|
210
|
+
listedRegistry<FlagEntry>('flag', flags.allFlags, (entry) => entry.key, flags.restoreFlags),
|
|
211
|
+
);
|
|
212
|
+
}
|
|
199
213
|
const oauth = moduleOf<OAuthModule>('@ultimat3/auth', 'oauth-registry.ts');
|
|
200
214
|
if (oauth !== undefined) {
|
|
201
215
|
registries.push(
|