@ultimat3/testing 31.41.0 → 31.42.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/errors.ts +2 -0
- package/src/fixture-island.ts +17 -7
- package/src/island-errors.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/testing",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.42.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.42.0",
|
|
51
|
+
"@ultimat3/ai": "31.42.0",
|
|
52
|
+
"@ultimat3/auth": "31.42.0",
|
|
53
|
+
"@ultimat3/cache": "31.42.0",
|
|
54
|
+
"@ultimat3/core": "31.42.0",
|
|
55
|
+
"@ultimat3/db": "31.42.0",
|
|
56
|
+
"@ultimat3/entity": "31.42.0",
|
|
57
|
+
"@ultimat3/http": "31.42.0",
|
|
58
|
+
"@ultimat3/i18n": "31.42.0",
|
|
59
|
+
"@ultimat3/jobs": "31.42.0",
|
|
60
|
+
"@ultimat3/mail": "31.42.0",
|
|
61
|
+
"@ultimat3/notify": "31.42.0",
|
|
62
|
+
"@ultimat3/policy": "31.42.0",
|
|
63
|
+
"@ultimat3/pwa": "31.42.0",
|
|
64
|
+
"@ultimat3/query": "31.42.0",
|
|
65
|
+
"@ultimat3/realtime": "31.42.0",
|
|
66
|
+
"@ultimat3/render": "31.42.0",
|
|
67
|
+
"@ultimat3/schema": "31.42.0",
|
|
68
|
+
"@ultimat3/scraping": "31.42.0",
|
|
69
|
+
"@ultimat3/seo": "31.42.0",
|
|
70
|
+
"@ultimat3/time": "31.42.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"solid-js": "^1.9.18"
|
package/src/errors.ts
CHANGED
|
@@ -82,6 +82,7 @@ export const TESTING_ERROR_CODES = [
|
|
|
82
82
|
'X_TEST_PROPERTY_FAILED',
|
|
83
83
|
'X_TEST_SOAK_HEAP_GROWTH',
|
|
84
84
|
'X_TEST_TEMP_TREE_LEFT',
|
|
85
|
+
'X_TEST_ISLAND_BUILD_REUSED',
|
|
85
86
|
] as const;
|
|
86
87
|
|
|
87
88
|
export type TestingErrorCode = (typeof TESTING_ERROR_CODES)[number];
|
|
@@ -167,6 +168,7 @@ export const TESTING_ERROR_TITLES: Readonly<Record<TestingErrorCode, string>> =
|
|
|
167
168
|
X_TEST_PROPERTY_FAILED: 'a property() run found an input its claim refuses',
|
|
168
169
|
X_TEST_SOAK_HEAP_GROWTH: 'a soak() run grew the live heap past its stated bound',
|
|
169
170
|
X_TEST_TEMP_TREE_LEFT: 'a temp tree survived its own remove',
|
|
171
|
+
X_TEST_ISLAND_BUILD_REUSED: 'an island builder answered the shipped build with the coverage one',
|
|
170
172
|
};
|
|
171
173
|
|
|
172
174
|
// Titles must be registered for `format()` to render the contract's first line. Every code above is
|
package/src/fixture-island.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { basename, join } from 'node:path';
|
|
|
8
8
|
import { onFileBoundary } from './file-boundary';
|
|
9
9
|
import { islandCoverageDir, recordChunkMap } from './fixture-island-coverage';
|
|
10
10
|
import { createIslandDocument, FakeElement, handlerFor, parseHtml } from './island-dom';
|
|
11
|
-
import { islandMountMissing, islandNotBuilt } from './island-errors';
|
|
11
|
+
import { IslandBuildReusedError, islandMountMissing, islandNotBuilt } from './island-errors';
|
|
12
12
|
import { installGlobals } from './island-globals';
|
|
13
13
|
import type { ResizeInput } from './island-observers';
|
|
14
14
|
import { deliverResize } from './island-observers';
|
|
@@ -208,6 +208,21 @@ export function disposeLiveIslands(): number {
|
|
|
208
208
|
// guard that runs the boundary, and a mount a file forgot is one only this module can see.
|
|
209
209
|
onFileBoundary(disposeLiveIslands);
|
|
210
210
|
|
|
211
|
+
/**
|
|
212
|
+
* The shipped chunk's source, asked of the builder a second time under a coverage run. The SAME
|
|
213
|
+
* bundle back is a memo that ignored `options` (`X_TEST_ISLAND_BUILD_REUSED`); a builder that
|
|
214
|
+
* ignores `coverage` altogether answers a fresh bundle and its chunk is what it is.
|
|
215
|
+
*/
|
|
216
|
+
async function shippedCode(
|
|
217
|
+
options: MountIslandOptions,
|
|
218
|
+
covered: IslandBundleLike,
|
|
219
|
+
chunk: IslandChunkLike,
|
|
220
|
+
): Promise<string> {
|
|
221
|
+
const bundle = await options.build(options.root, { only: options.file });
|
|
222
|
+
if (bundle === covered) throw new IslandBuildReusedError({ file: options.file });
|
|
223
|
+
return bundle.chunks.find((each) => each.file === options.file)?.code ?? chunk.code;
|
|
224
|
+
}
|
|
225
|
+
|
|
211
226
|
export async function mountIsland(options: MountIslandOptions): Promise<MountedIsland> {
|
|
212
227
|
// `only`, because this fixture has always KNOWN which island it wants and asked for all of them
|
|
213
228
|
// anyway — `island-bundle.ts` added the option for exactly this caller ("a test that mounts a
|
|
@@ -238,12 +253,7 @@ export async function mountIsland(options: MountIslandOptions): Promise<MountedI
|
|
|
238
253
|
|
|
239
254
|
// What `code` answers is what ships: a coverage build keeps whitespace for its map, and an app's
|
|
240
255
|
// 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);
|
|
256
|
+
const shipped = coverage === undefined ? chunk.code : await shippedCode(options, bundle, chunk);
|
|
247
257
|
|
|
248
258
|
const { documentElement, globals, resizeObservers } = createIslandDocument();
|
|
249
259
|
const restore = installGlobals({ ...globals, ...options.globals });
|
package/src/island-errors.ts
CHANGED
|
@@ -80,3 +80,19 @@ export class IslandMountMissingError extends UltimateError {
|
|
|
80
80
|
|
|
81
81
|
export const islandMountMissing = (file: string, exported: readonly string[]): UltimateError =>
|
|
82
82
|
new IslandMountMissingError({ file, exported });
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Under the gate's coverage run a mount asks its builder twice — covered to run, shipped for `code`
|
|
86
|
+
* — and got the SAME bundle back: a memo round `buildIslands` that ignores `options`. Measured
|
|
87
|
+
* instead, every size ceiling would read the unminified chunk, green under `bun test` and red in
|
|
88
|
+
* `x verify`.
|
|
89
|
+
*/
|
|
90
|
+
export class IslandBuildReusedError extends UltimateError {
|
|
91
|
+
constructor(input: { file: string }) {
|
|
92
|
+
super({
|
|
93
|
+
code: 'X_TEST_ISLAND_BUILD_REUSED',
|
|
94
|
+
cause: `the builder handed ${renderCauseValue(input.file)}'s mount the same bundle for the coverage build and the shipped one, so code would be the unminified chunk`,
|
|
95
|
+
fix: 'mountIsland({ build: buildIslands, root, file }) # the builder itself (describeIslandState already builds once per file), or key your memo by options.coverage',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|