@smoothbricks/nx-plugin 0.4.29 → 0.4.30
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/README.md +83 -15
- package/dist/bin/smoo-nx-test-clocks.d.ts +3 -0
- package/dist/bin/smoo-nx-test-clocks.d.ts.map +1 -0
- package/dist/bin/smoo-nx-test-clocks.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -8
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +2 -8
- package/dist/cargo-closure-input.d.ts +11 -0
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +16 -6
- package/dist/ensure-built-receipt.d.ts +8 -2
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +45 -13
- package/dist/ensure-built-witness.d.ts +40 -4
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +68 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +11 -3
- package/dist/executors/bounded-exec/cpu-pool.d.ts +7 -3
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +9 -4
- package/dist/executors/bounded-exec/executor.d.ts +1 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +35 -12
- package/dist/executors/bounded-exec/no-space.d.ts +8 -0
- package/dist/executors/bounded-exec/no-space.d.ts.map +1 -0
- package/dist/executors/bounded-exec/no-space.js +31 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +3 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +15 -4
- package/dist/executors/bounded-exec/verdict.d.ts +34 -4
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +54 -3
- package/dist/graph-input-contract.d.ts +4 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +17 -4
- package/dist/owned-installation.d.ts +14 -0
- package/dist/owned-installation.d.ts.map +1 -0
- package/dist/owned-installation.js +324 -0
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +15 -10
- package/dist/test-backstop.d.ts +9 -0
- package/dist/test-backstop.d.ts.map +1 -0
- package/dist/test-backstop.js +10 -0
- package/dist/test-clock-policy.d.ts +30 -0
- package/dist/test-clock-policy.d.ts.map +1 -0
- package/dist/test-clock-policy.js +686 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +8 -1
- package/managed/raw/tooling/direnv/developer-links.ts +1 -8
- package/managed/raw/tooling/direnv/setup-environment.ts +0 -1
- package/package.json +15 -4
- package/src/__tests__/cargo-closure-fixture.ts +113 -0
- package/src/__tests__/counted-cargo.ts +8 -25
- package/src/__tests__/directory-change.ts +27 -0
- package/src/__tests__/owned-installation.ts +4 -164
- package/src/__tests__/past-tick.ts +12 -0
- package/src/bin/smoo-nx-test-clocks.ts +29 -0
- package/src/bounded-test-policy.ts +2 -8
- package/src/cargo-closure-input.property.test.ts +50 -0
- package/src/cargo-closure-input.test.ts +15 -112
- package/src/cargo-closure-input.ts +23 -6
- package/src/cargo-closure-key.test.ts +239 -0
- package/src/cargo-resolve-cache.test.ts +29 -7
- package/src/ensure-built-receipt.ts +56 -13
- package/src/ensure-built-witness.test.ts +113 -4
- package/src/ensure-built-witness.ts +75 -16
- package/src/ensure-built.test.ts +74 -2
- package/src/ensure-built.ts +13 -2
- package/src/executors/bounded-exec/cpu-pool.test.ts +18 -0
- package/src/executors/bounded-exec/cpu-pool.ts +10 -4
- package/src/executors/bounded-exec/disk-lease.test.ts +47 -13
- package/src/executors/bounded-exec/executor-host.test.ts +23 -11
- package/src/executors/bounded-exec/executor.test.ts +189 -63
- package/src/executors/bounded-exec/executor.ts +36 -11
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +14 -8
- package/src/executors/bounded-exec/no-space.ts +40 -0
- package/src/executors/bounded-exec/ram-temp-host.test.ts +9 -8
- package/src/executors/bounded-exec/ram-temp.test.ts +32 -18
- package/src/executors/bounded-exec/ram-temp.ts +17 -4
- package/src/executors/bounded-exec/verdict.test.ts +125 -25
- package/src/executors/bounded-exec/verdict.ts +78 -3
- package/src/graph-input-contract.test.ts +8 -0
- package/src/graph-input-contract.ts +26 -4
- package/src/nextest-extraction.test.ts +114 -4
- package/src/nx-daemon-claim.test.ts +5 -3
- package/src/nx-daemon-idle-policy.test.ts +22 -18
- package/src/nx-daemon-validity.test.ts +5 -13
- package/src/owned-installation.ts +174 -0
- package/src/producer-receipts.ts +15 -10
- package/src/test-backstop.ts +11 -0
- package/src/test-clock-policy.test.ts +338 -0
- package/src/test-clock-policy.ts +708 -0
- package/src/testing.ts +8 -1
- package/test-timings.json +3 -0
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
* tests, so this is a hang, not a slow host, and the fix is the opposite one, so it is never a `bound`. It names
|
|
10
10
|
* the tests still running: those the runner said were running and never said finished, and those its report says
|
|
11
11
|
* it aborted when the bound stopped it.
|
|
12
|
+
* - `no-space`: the run failed and its output said a write found no space (ENOSPC). Whatever its tests then reported,
|
|
13
|
+
* they failed on the disk, not on their own: the verdict names the line that said so and, when the task held one,
|
|
14
|
+
* its RAM temp volume as it stood when that line arrived.
|
|
12
15
|
* - `failed`: anything else that did not pass. That includes an assertion named in the report,
|
|
13
16
|
* or a non-zero exit with no report to say why.
|
|
14
17
|
*/
|
|
@@ -28,11 +31,27 @@ export type BoundedExecVerdict = {
|
|
|
28
31
|
readonly idleMs: number;
|
|
29
32
|
readonly elapsedMs: number;
|
|
30
33
|
readonly tests: readonly string[];
|
|
31
|
-
} | {
|
|
34
|
+
} | ({
|
|
35
|
+
readonly outcome: 'no-space';
|
|
36
|
+
readonly exitCode: number;
|
|
37
|
+
readonly tests: readonly string[];
|
|
38
|
+
} & NoSpaceSighting) | {
|
|
32
39
|
readonly outcome: 'failed';
|
|
33
40
|
readonly exitCode: number;
|
|
34
41
|
readonly tests: readonly string[];
|
|
35
42
|
};
|
|
43
|
+
/** The task's RAM temp volume, read when a line saying ENOSPC arrived: the writer's own lease, and the space left. */
|
|
44
|
+
export interface TempVolumeSpace {
|
|
45
|
+
readonly lease: string;
|
|
46
|
+
readonly mountpoint: string;
|
|
47
|
+
readonly capacityBytes: number;
|
|
48
|
+
readonly freeBytes: number;
|
|
49
|
+
}
|
|
50
|
+
/** The first output line that said a write found no space, and the task's RAM temp volume then; `null` without one. */
|
|
51
|
+
export interface NoSpaceSighting {
|
|
52
|
+
readonly line: string;
|
|
53
|
+
readonly volume: TempVolumeSpace | null;
|
|
54
|
+
}
|
|
36
55
|
/** One task's verdict, keyed by the Nx task and the hash it ran at. */
|
|
37
56
|
export interface BoundedExecRecord {
|
|
38
57
|
readonly task: string;
|
|
@@ -95,11 +114,16 @@ export interface RunEnd {
|
|
|
95
114
|
readonly expiry: ExpiredBound | null;
|
|
96
115
|
/** The run's report, or `null` when the command was asked for none or wrote none. */
|
|
97
116
|
readonly report: JunitFailures | null;
|
|
117
|
+
/** The first output line that said ENOSPC, or `null` when none did. */
|
|
118
|
+
readonly noSpace: NoSpaceSighting | null;
|
|
98
119
|
}
|
|
99
120
|
/**
|
|
100
|
-
* Judge a run. A
|
|
101
|
-
*
|
|
102
|
-
*
|
|
121
|
+
* Judge a run. A run that failed after its output said ENOSPC failed on the disk: that is read first, ahead of the
|
|
122
|
+
* tests it then failed, a bound it then hit or a hang the full disk caused; a passing run that printed it (a test of
|
|
123
|
+
* its own ENOSPC handling) passed. A test that failed on its own is a failure even when a bound fired too, and the
|
|
124
|
+
* no-progress bound is never load: the report's assertions and the idle bound are read next. A test the runner aborted
|
|
125
|
+
* because the total bound told its command to stop is not one that failed; one it aborted at the idle bound is a test
|
|
126
|
+
* still running.
|
|
103
127
|
*/
|
|
104
128
|
export declare function judgeRun(run: RunEnd): BoundedExecVerdict;
|
|
105
129
|
/**
|
|
@@ -159,4 +183,10 @@ export type FailedTask = {
|
|
|
159
183
|
*/
|
|
160
184
|
export declare function failedTasksOfRun(runJson: unknown, workspaceData: string): Promise<FailedTask[]>;
|
|
161
185
|
export declare function describeVerdict(verdict: BoundedExecVerdict): string;
|
|
186
|
+
/**
|
|
187
|
+
* What a run's output said about a write that found no space, and where the run's temp files lived then. The free
|
|
188
|
+
* space is read when the line arrives, not after the command exits: by then a writer that failed has usually removed
|
|
189
|
+
* its half-written files and the volume no longer looks full.
|
|
190
|
+
*/
|
|
191
|
+
export declare function describeNoSpace(sighting: NoSpaceSighting): string;
|
|
162
192
|
//# sourceMappingURL=verdict.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/verdict.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/verdict.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC5G;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACxF;IACE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3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AAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA6BrG;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAqBnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAQjE"}
|
|
@@ -94,11 +94,18 @@ function decodeEntities(value) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Judge a run. A
|
|
98
|
-
*
|
|
99
|
-
*
|
|
97
|
+
* Judge a run. A run that failed after its output said ENOSPC failed on the disk: that is read first, ahead of the
|
|
98
|
+
* tests it then failed, a bound it then hit or a hang the full disk caused; a passing run that printed it (a test of
|
|
99
|
+
* its own ENOSPC handling) passed. A test that failed on its own is a failure even when a bound fired too, and the
|
|
100
|
+
* no-progress bound is never load: the report's assertions and the idle bound are read next. A test the runner aborted
|
|
101
|
+
* because the total bound told its command to stop is not one that failed; one it aborted at the idle bound is a test
|
|
102
|
+
* still running.
|
|
100
103
|
*/
|
|
101
104
|
export function judgeRun(run) {
|
|
105
|
+
if (run.noSpace !== null && (run.exitCode !== 0 || run.expiry !== null)) {
|
|
106
|
+
const tests = run.report === null ? [] : [...run.report.failed, ...run.report.timedOut, ...run.report.cancelled];
|
|
107
|
+
return { outcome: 'no-space', exitCode: run.exitCode === 0 ? 1 : run.exitCode, tests, ...run.noSpace };
|
|
108
|
+
}
|
|
102
109
|
if (run.expiry?.kind === 'idle') {
|
|
103
110
|
const tests = [...new Set([...run.expiry.tests, ...(run.report?.cancelled ?? [])])];
|
|
104
111
|
return { outcome: 'wedged', idleMs: run.expiry.limitMs, elapsedMs: run.elapsedMs, tests };
|
|
@@ -245,6 +252,19 @@ function parseVerdict(value) {
|
|
|
245
252
|
return { outcome: 'wedged', idleMs: value.idleMs, elapsedMs: value.elapsedMs, tests: value.tests };
|
|
246
253
|
}
|
|
247
254
|
break;
|
|
255
|
+
case 'no-space': {
|
|
256
|
+
const volume = parseTempVolumeSpace(value.volume);
|
|
257
|
+
if (typeof value.exitCode === 'number' && isStrings(value.tests) && typeof value.line === 'string' && volume) {
|
|
258
|
+
return {
|
|
259
|
+
outcome: 'no-space',
|
|
260
|
+
exitCode: value.exitCode,
|
|
261
|
+
tests: value.tests,
|
|
262
|
+
line: value.line,
|
|
263
|
+
volume: volume.value,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
248
268
|
case 'failed':
|
|
249
269
|
if (typeof value.exitCode === 'number' && isStrings(value.tests)) {
|
|
250
270
|
return { outcome: 'failed', exitCode: value.exitCode, tests: value.tests };
|
|
@@ -254,6 +274,21 @@ function parseVerdict(value) {
|
|
|
254
274
|
}
|
|
255
275
|
throw new Error(`not a bounded-exec verdict: ${JSON.stringify(value)}`);
|
|
256
276
|
}
|
|
277
|
+
/** A recorded volume, wrapped so a well-formed `null` (no RAM volume) differs from a malformed one (`undefined`). */
|
|
278
|
+
function parseTempVolumeSpace(value) {
|
|
279
|
+
if (value === null) {
|
|
280
|
+
return { value: null };
|
|
281
|
+
}
|
|
282
|
+
if (isObject(value) &&
|
|
283
|
+
typeof value.lease === 'string' &&
|
|
284
|
+
typeof value.mountpoint === 'string' &&
|
|
285
|
+
typeof value.capacityBytes === 'number' &&
|
|
286
|
+
typeof value.freeBytes === 'number') {
|
|
287
|
+
const { lease, mountpoint, capacityBytes, freeBytes } = value;
|
|
288
|
+
return { value: { lease, mountpoint, capacityBytes, freeBytes } };
|
|
289
|
+
}
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
257
292
|
function isObject(value) {
|
|
258
293
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
259
294
|
}
|
|
@@ -310,9 +345,25 @@ export function describeVerdict(verdict) {
|
|
|
310
345
|
return `wedged: no test finished for ${verdict.idleMs}ms after ${verdict.elapsedMs}ms; ${verdict.tests.length > 0
|
|
311
346
|
? `still running: ${verdict.tests.join(', ')}`
|
|
312
347
|
: 'the runner named no test still running'}`;
|
|
348
|
+
case 'no-space':
|
|
349
|
+
return `${describeNoSpace(verdict)}${verdict.tests.length > 0 ? `; the tests that then failed: ${verdict.tests.join(', ')}` : ''}`;
|
|
313
350
|
case 'failed':
|
|
314
351
|
return verdict.tests.length > 0
|
|
315
352
|
? `failed: ${verdict.tests.join(', ')}`
|
|
316
353
|
: `exited ${verdict.exitCode} with no report naming a timeout`;
|
|
317
354
|
}
|
|
318
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* What a run's output said about a write that found no space, and where the run's temp files lived then. The free
|
|
358
|
+
* space is read when the line arrives, not after the command exits: by then a writer that failed has usually removed
|
|
359
|
+
* its half-written files and the volume no longer looks full.
|
|
360
|
+
*/
|
|
361
|
+
export function describeNoSpace(sighting) {
|
|
362
|
+
const said = `ENOSPC (no space left on device): the command printed ${JSON.stringify(sighting.line)}`;
|
|
363
|
+
const volume = sighting.volume;
|
|
364
|
+
if (volume === null) {
|
|
365
|
+
return `${said}; it held no RAM temp volume, so the full disk is the one that line's writer wrote to`;
|
|
366
|
+
}
|
|
367
|
+
const mib = (bytes) => (bytes / (1024 * 1024)).toFixed(1);
|
|
368
|
+
return `${said}; its TMPDIR ${volume.lease} is on the RAM temp volume ${volume.mountpoint}, which had ${mib(volume.freeBytes)} MiB free of ${mib(volume.capacityBytes)} MiB when that line arrived`;
|
|
369
|
+
}
|
|
@@ -73,6 +73,10 @@ export declare class GraphInputReadCollector {
|
|
|
73
73
|
private readonly scanned;
|
|
74
74
|
private readonly gitScopes;
|
|
75
75
|
private detail;
|
|
76
|
+
/** Read before the first observation: what each node stamp this reader records is judged by (unproven). */
|
|
77
|
+
private readonly start;
|
|
78
|
+
/** The witness's stamp of each node this reader read in the tick it changed in (recordedStamp), by path. */
|
|
79
|
+
private readonly unprovenStamps;
|
|
76
80
|
constructor(workspaceRoot: string, plugin: string, options: unknown);
|
|
77
81
|
refuse(detail: string): void;
|
|
78
82
|
private protect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-input-contract.d.ts","sourceRoot":"","sources":["../src/graph-input-contract.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-input-contract.d.ts","sourceRoot":"","sources":["../src/graph-input-contract.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAWhF,mGAAmG;AACnG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;IACrE,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChF,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AACD,UAAU,iBAAiB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AACD,UAAU,WAA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BAAmB,EAC3B,QAAQ,EAAE,iBAAiB,GAC1B,uBAAuB,GAAG,IAAI,CAuHhC"}
|
|
@@ -4,7 +4,7 @@ import { accessSync, constants, existsSync, lstatSync, mkdirSync, readdirSync, r
|
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
import { delimiter, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
6
6
|
import typia from 'typia';
|
|
7
|
-
import { nodeStamp, nodesUnchanged, workspaceSnapshot } from './ensure-built-witness.js';
|
|
7
|
+
import { censusStart, movedNodes, nodeStamp, nodesUnchanged, recordedStamp, unproven, workspaceSnapshot, } from './ensure-built-witness.js';
|
|
8
8
|
function digest(value) {
|
|
9
9
|
return createHash('sha256').update(value).digest('hex');
|
|
10
10
|
}
|
|
@@ -92,6 +92,10 @@ export class GraphInputReadCollector {
|
|
|
92
92
|
scanned = new Set();
|
|
93
93
|
gitScopes = new Set();
|
|
94
94
|
detail;
|
|
95
|
+
/** Read before the first observation: what each node stamp this reader records is judged by (unproven). */
|
|
96
|
+
start = censusStart();
|
|
97
|
+
/** The witness's stamp of each node this reader read in the tick it changed in (recordedStamp), by path. */
|
|
98
|
+
unprovenStamps = new Map();
|
|
95
99
|
constructor(workspaceRoot, plugin, options) {
|
|
96
100
|
this.workspaceRoot = workspaceRoot;
|
|
97
101
|
this.plugin = plugin;
|
|
@@ -158,8 +162,12 @@ export class GraphInputReadCollector {
|
|
|
158
162
|
const stamp = scope === 'path' ? pathStamp(stats) : nodeStamp(stats);
|
|
159
163
|
if (previous !== undefined && previous.stamp !== (previous.scope === scope ? stamp : pathStamp(stats)))
|
|
160
164
|
this.refuse(`input changed during read: ${path}`);
|
|
161
|
-
if (previous === undefined || previous.scope !== scope)
|
|
165
|
+
if (previous === undefined || previous.scope !== scope) {
|
|
162
166
|
this.nodes.set(path, { path, scope, stamp });
|
|
167
|
+
// A path stamp holds no time; a node stamp read in its node's change tick is recorded unproven.
|
|
168
|
+
if (scope === 'node' && unproven(stats, this.start))
|
|
169
|
+
this.unprovenStamps.set(path, recordedStamp(stats, this.start));
|
|
170
|
+
}
|
|
163
171
|
if (stats.isSymbolicLink())
|
|
164
172
|
this.observe(realpathSync(path), membership);
|
|
165
173
|
else if (stats.isFile())
|
|
@@ -358,9 +366,11 @@ export class GraphInputReadCollector {
|
|
|
358
366
|
if (this.before === undefined)
|
|
359
367
|
return;
|
|
360
368
|
const after = captureNative(this.workspaceRoot, this.before);
|
|
369
|
+
// `after` re-hashed every node whose stamp does not prove it (its ctime alone moved, or `before` read it in the
|
|
370
|
+
// tick it changed in), and its native identity must be `before`'s.
|
|
361
371
|
if (!after.stable ||
|
|
362
372
|
nativeIdentity(after.files) !== nativeIdentity(this.before.files) ||
|
|
363
|
-
|
|
373
|
+
movedNodes(this.before.nodes, () => true) !== null ||
|
|
364
374
|
!readNodesUnchanged([...this.nodes.values()]))
|
|
365
375
|
this.refuse('graph inputs changed during the owning reader');
|
|
366
376
|
if (environmentIdentity(this.workspaceRoot) !== this.environment)
|
|
@@ -374,7 +384,10 @@ export class GraphInputReadCollector {
|
|
|
374
384
|
status: 'complete',
|
|
375
385
|
nativeIdentity: nativeIdentity(this.before.files),
|
|
376
386
|
nativeNodes: this.before.nodes,
|
|
377
|
-
nodes: [...this.nodes.values()]
|
|
387
|
+
nodes: [...this.nodes.values()].map((node) => {
|
|
388
|
+
const stamp = this.unprovenStamps.get(node.path);
|
|
389
|
+
return stamp === undefined ? node : { ...node, stamp };
|
|
390
|
+
}),
|
|
378
391
|
missing: [...this.missing].sort(),
|
|
379
392
|
resolutions: this.resolutions,
|
|
380
393
|
tools: [...this.tools.values()],
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** One test file's installation: made on first use and shared by its fixtures, retired by the file's `afterAll`. */
|
|
2
|
+
export interface TestFileInstallation {
|
|
3
|
+
/** The `node_modules` a fixture workspace links. */
|
|
4
|
+
readonly nodeModules: () => Promise<string>;
|
|
5
|
+
/** Fails if a fixture wrote into the copy; a file that never used it has nothing to retire. */
|
|
6
|
+
readonly retire: () => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The installation one test file owns: a copy of the closure `censusRoot` (the workspace whose Nx, plugin and
|
|
10
|
+
* TypeScript the fixtures stand for) resolves, made in the empty directory `makeRoot` creates on first use. Call once
|
|
11
|
+
* per file, at module scope: Bun runs many test files in one process, and each must own its copy.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ownedInstallation(censusRoot: string, makeRoot: () => Promise<string>): TestFileInstallation;
|
|
14
|
+
//# sourceMappingURL=owned-installation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned-installation.d.ts","sourceRoot":"","sources":["../src/owned-installation.ts"],"names":[],"mappings":"AAqJA,oHAAoH;AACpH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAW3G"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import * as _assertGuard_1 from "typia/lib/internal/_assertGuard";
|
|
2
|
+
import * as _accessExpressionAsString_1 from "typia/lib/internal/_accessExpressionAsString";
|
|
3
|
+
const __typia_transform__accessExpressionAsString = _accessExpressionAsString_1._accessExpressionAsString;
|
|
4
|
+
/**
|
|
5
|
+
* A fixture's own copy of a workspace's Nx installation, and the check that nothing wrote into it.
|
|
6
|
+
*
|
|
7
|
+
* The graph witness binds node stamps (ctime included) of every file in the closure of Nx, this plugin and
|
|
8
|
+
* TypeScript (README "Ancestor directories bind..."). Linked from a workspace, that closure is the host's: on CI
|
|
9
|
+
* its files are hardlinks in the shared Bun store, and any other task that installs, restores or cleans changes their
|
|
10
|
+
* link count, so their ctime, so a fixture's installation identity, between two calls of one test. Where this plugin
|
|
11
|
+
* is a developer link, the closure is also a live checkout that its own author edits and rebuilds while a consumer's
|
|
12
|
+
* test reads it. A fixture must not take an input it does not own.
|
|
13
|
+
*
|
|
14
|
+
* So the closure is copied, exactly as the witness's own census resolves it from the workspace that names it: each
|
|
15
|
+
* package once, with the census's own exclusions (`node_modules`, `.git`, `.nx`), each dependency edge relinked beside
|
|
16
|
+
* its copy as Bun's isolated layout does, the top-level packages' bins in `.bin`. Every copy is a new inode, cloned
|
|
17
|
+
* where the volume allows and written otherwise, so no link count is shared with anything outside its owner.
|
|
18
|
+
*
|
|
19
|
+
* A test file makes one copy, on first use, shared by its fixtures; retiring it fails, naming the changed nodes, if
|
|
20
|
+
* any fixture wrote into it.
|
|
21
|
+
*/
|
|
22
|
+
import { constants } from 'node:fs';
|
|
23
|
+
import { cp, mkdir, readFile, rm, symlink } from 'node:fs/promises';
|
|
24
|
+
import { basename, dirname, join, relative } from 'node:path';
|
|
25
|
+
import { expandOutputs } from 'nx/src/native';
|
|
26
|
+
import { readModulePackageJson } from 'nx/src/utils/package-json';
|
|
27
|
+
import typia from 'typia';
|
|
28
|
+
import { graphInstallationCensus, graphInstallationIdentity, } from './ensure-built-witness.js';
|
|
29
|
+
/** The configuration the census resolves: Nx, this plugin and TypeScript. */
|
|
30
|
+
const CENSUS_NX_JSON = { plugins: ['@smoothbricks/nx-plugin'] };
|
|
31
|
+
/** The graph witness's installation identity resolved from `root`; an unproved installation fails loudly. */
|
|
32
|
+
function installationIdentity(root) {
|
|
33
|
+
let unproved = 'no detail';
|
|
34
|
+
const identity = graphInstallationIdentity(root, CENSUS_NX_JSON, readModulePackageJson, expandOutputs, null, (detail) => {
|
|
35
|
+
unproved = detail;
|
|
36
|
+
});
|
|
37
|
+
if (identity === null)
|
|
38
|
+
throw new Error(`the Nx installation resolved from ${root} is unproved: ${unproved}`);
|
|
39
|
+
return identity;
|
|
40
|
+
}
|
|
41
|
+
/** Copy the installation closure `censusRoot` resolves into `root/node_modules`; `root` is an empty directory the
|
|
42
|
+
* caller owns.
|
|
43
|
+
*
|
|
44
|
+
* Only the closure is read from `censusRoot`, never its proof: that installation is the host's, whose shared store
|
|
45
|
+
* other tasks relink while the census reads it, which changes node stamps and would make every test that copies it
|
|
46
|
+
* fail for the host's work rather than its own. The copy, which the fixture owns, is what gets proved.
|
|
47
|
+
*/
|
|
48
|
+
async function makeOwnedInstallation(censusRoot, root) {
|
|
49
|
+
let unread = 'no detail';
|
|
50
|
+
const census = graphInstallationCensus(censusRoot, CENSUS_NX_JSON, readModulePackageJson, expandOutputs, null, (detail) => {
|
|
51
|
+
unread = detail;
|
|
52
|
+
});
|
|
53
|
+
if (census === null)
|
|
54
|
+
throw new Error(`the Nx installation closure of ${censusRoot} cannot be read: ${unread}`);
|
|
55
|
+
const { resolutions } = census;
|
|
56
|
+
const modules = join(root, 'node_modules');
|
|
57
|
+
// Each source package root's copy, inside a store directory whose node_modules also holds its dependency links.
|
|
58
|
+
const copies = new Map();
|
|
59
|
+
for (const [, , manifest] of resolutions) {
|
|
60
|
+
if (manifest === null || copies.has(dirname(manifest)))
|
|
61
|
+
continue;
|
|
62
|
+
const { name, bin } = (() => {
|
|
63
|
+
const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.name || _assertGuard_1._assertGuard(_exceptionable, {
|
|
64
|
+
method: "typia.json.assertParse",
|
|
65
|
+
path: _path + ".name",
|
|
66
|
+
expected: "string",
|
|
67
|
+
value: input.name
|
|
68
|
+
}, _errorFactory)) && ((null !== input.bin || _assertGuard_1._assertGuard(_exceptionable, {
|
|
69
|
+
method: "typia.json.assertParse",
|
|
70
|
+
path: _path + ".bin",
|
|
71
|
+
expected: "(Record<string, string> | string | undefined)",
|
|
72
|
+
value: input.bin
|
|
73
|
+
}, _errorFactory)) && (undefined === input.bin || "string" === typeof input.bin || ("object" === typeof input.bin && null !== input.bin && false === Array.isArray(input.bin) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
74
|
+
method: "typia.json.assertParse",
|
|
75
|
+
path: _path + ".bin",
|
|
76
|
+
expected: "(Record<string, string> | string | undefined)",
|
|
77
|
+
value: input.bin
|
|
78
|
+
}, _errorFactory)) && _ao1(input.bin, _path + ".bin", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
79
|
+
method: "typia.json.assertParse",
|
|
80
|
+
path: _path + ".bin",
|
|
81
|
+
expected: "(Record<string, string> | string | undefined)",
|
|
82
|
+
value: input.bin
|
|
83
|
+
}, _errorFactory)));
|
|
84
|
+
const _ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
|
|
85
|
+
const value = input[key];
|
|
86
|
+
if (undefined === value)
|
|
87
|
+
return true;
|
|
88
|
+
return "string" === typeof value || _assertGuard_1._assertGuard(_exceptionable, {
|
|
89
|
+
method: "typia.json.assertParse",
|
|
90
|
+
path: _path + __typia_transform__accessExpressionAsString(key),
|
|
91
|
+
expected: "string",
|
|
92
|
+
value: value
|
|
93
|
+
}, _errorFactory);
|
|
94
|
+
});
|
|
95
|
+
const _io0 = input => "string" === typeof input.name && (null !== input.bin && (undefined === input.bin || "string" === typeof input.bin || "object" === typeof input.bin && null !== input.bin && false === Array.isArray(input.bin) && _io1(input.bin)));
|
|
96
|
+
const _io1 = input => Object.keys(input).every(key => {
|
|
97
|
+
const value = input[key];
|
|
98
|
+
if (undefined === value)
|
|
99
|
+
return true;
|
|
100
|
+
return "string" === typeof value;
|
|
101
|
+
});
|
|
102
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
103
|
+
let _errorFactory;
|
|
104
|
+
const __assert = (input, errorFactory) => {
|
|
105
|
+
if (false === __is(input)) {
|
|
106
|
+
_errorFactory = errorFactory;
|
|
107
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _assertGuard_1._assertGuard(true, {
|
|
108
|
+
method: "typia.json.assertParse",
|
|
109
|
+
path: _path + "",
|
|
110
|
+
expected: "{ name: string; bin?: string | Record<string, string> | undefined; }",
|
|
111
|
+
value: input
|
|
112
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard_1._assertGuard(true, {
|
|
113
|
+
method: "typia.json.assertParse",
|
|
114
|
+
path: _path + "",
|
|
115
|
+
expected: "{ name: string; bin?: string | Record<string, string> | undefined; }",
|
|
116
|
+
value: input
|
|
117
|
+
}, _errorFactory))(input, "$input", true);
|
|
118
|
+
}
|
|
119
|
+
return input;
|
|
120
|
+
};
|
|
121
|
+
return (input, errorFactory) => __assert(JSON.parse(input), errorFactory);
|
|
122
|
+
})()(await readFile(manifest, 'utf8'));
|
|
123
|
+
const store = join(modules, '.store', String(copies.size), 'node_modules');
|
|
124
|
+
copies.set(dirname(manifest), { store, copy: join(store, name), bin });
|
|
125
|
+
}
|
|
126
|
+
const copyOf = (source) => {
|
|
127
|
+
const copied = copies.get(source);
|
|
128
|
+
if (copied === undefined)
|
|
129
|
+
throw new Error(`${source} resolves dependencies but is not in the census`);
|
|
130
|
+
return copied;
|
|
131
|
+
};
|
|
132
|
+
await Promise.all([...copies].map(([source, { copy }]) => cp(source, copy, {
|
|
133
|
+
recursive: true,
|
|
134
|
+
verbatimSymlinks: true,
|
|
135
|
+
mode: constants.COPYFILE_FICLONE,
|
|
136
|
+
filter: (path) => path === source || !['node_modules', '.git', '.nx'].includes(basename(path)),
|
|
137
|
+
})));
|
|
138
|
+
for (const [from, name, manifest] of resolutions) {
|
|
139
|
+
if (manifest === null)
|
|
140
|
+
continue;
|
|
141
|
+
const link = join(from === censusRoot ? modules : copyOf(from).store, name);
|
|
142
|
+
await mkdir(dirname(link), { recursive: true });
|
|
143
|
+
await symlink(relative(dirname(link), copyOf(dirname(manifest)).copy), link, 'dir');
|
|
144
|
+
if (from !== censusRoot)
|
|
145
|
+
continue;
|
|
146
|
+
const { bin } = copyOf(dirname(manifest));
|
|
147
|
+
const commands = typeof bin === 'string' ? { [basename(name)]: bin } : (bin ?? {});
|
|
148
|
+
for (const [command, path] of Object.entries(commands)) {
|
|
149
|
+
await mkdir(join(modules, '.bin'), { recursive: true });
|
|
150
|
+
await symlink(relative(join(modules, '.bin'), join(link, path)), join(modules, '.bin', command));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { root, identity: installationIdentity(root) };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Remove an installation, failing, with the changed nodes named, if its identity is no longer the one it was made
|
|
157
|
+
* with: the proof that its sharers only read it.
|
|
158
|
+
*/
|
|
159
|
+
async function retireOwnedInstallation({ root, identity }) {
|
|
160
|
+
try {
|
|
161
|
+
const retired = installationIdentity(root);
|
|
162
|
+
if (retired === identity)
|
|
163
|
+
return;
|
|
164
|
+
const entries = (census) => {
|
|
165
|
+
const { nodes, files } = (() => {
|
|
166
|
+
const _ip0 = input => "string" === typeof input["path"];
|
|
167
|
+
const _ap0 = (input, _path, _exceptionable = true) => "string" === typeof input["path"] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
168
|
+
method: "typia.json.assertParse",
|
|
169
|
+
path: _path + ".path",
|
|
170
|
+
expected: "string",
|
|
171
|
+
value: input["path"]
|
|
172
|
+
}, _errorFactory);
|
|
173
|
+
const _ao0 = (input, _path, _exceptionable = true) => ((Array.isArray(input.resolutions) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
174
|
+
method: "typia.json.assertParse",
|
|
175
|
+
path: _path + ".resolutions",
|
|
176
|
+
expected: "ReadonlyArray<readonly [string, string, string | null]>",
|
|
177
|
+
value: input.resolutions
|
|
178
|
+
}, _errorFactory)) && input.resolutions.every((elem, _index4) => (Array.isArray(elem) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
179
|
+
method: "typia.json.assertParse",
|
|
180
|
+
path: _path + ".resolutions[" + _index4 + "]",
|
|
181
|
+
expected: "readonly [string, string, string | null]",
|
|
182
|
+
value: elem
|
|
183
|
+
}, _errorFactory)) && ((elem.length === 3 || _assertGuard_1._assertGuard(_exceptionable, {
|
|
184
|
+
method: "typia.json.assertParse",
|
|
185
|
+
path: _path + ".resolutions[" + _index4 + "]",
|
|
186
|
+
expected: "[string, string, (null | string)]",
|
|
187
|
+
value: elem
|
|
188
|
+
}, _errorFactory)) && ("string" === typeof elem[0] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
189
|
+
method: "typia.json.assertParse",
|
|
190
|
+
path: _path + ".resolutions[" + _index4 + "][0]",
|
|
191
|
+
expected: "string",
|
|
192
|
+
value: elem[0]
|
|
193
|
+
}, _errorFactory)) && ("string" === typeof elem[1] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
194
|
+
method: "typia.json.assertParse",
|
|
195
|
+
path: _path + ".resolutions[" + _index4 + "][1]",
|
|
196
|
+
expected: "string",
|
|
197
|
+
value: elem[1]
|
|
198
|
+
}, _errorFactory)) && (null === elem[2] || "string" === typeof elem[2] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
199
|
+
method: "typia.json.assertParse",
|
|
200
|
+
path: _path + ".resolutions[" + _index4 + "][2]",
|
|
201
|
+
expected: "(null | string)",
|
|
202
|
+
value: elem[2]
|
|
203
|
+
}, _errorFactory))) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
204
|
+
method: "typia.json.assertParse",
|
|
205
|
+
path: _path + ".resolutions[" + _index4 + "]",
|
|
206
|
+
expected: "readonly [string, string, string | null]",
|
|
207
|
+
value: elem
|
|
208
|
+
}, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
209
|
+
method: "typia.json.assertParse",
|
|
210
|
+
path: _path + ".resolutions",
|
|
211
|
+
expected: "ReadonlyArray<readonly [string, string, string | null]>",
|
|
212
|
+
value: input.resolutions
|
|
213
|
+
}, _errorFactory)) && ((Array.isArray(input.nodes) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
214
|
+
method: "typia.json.assertParse",
|
|
215
|
+
path: _path + ".nodes",
|
|
216
|
+
expected: "ReadonlyArray<NodeWitness>",
|
|
217
|
+
value: input.nodes
|
|
218
|
+
}, _errorFactory)) && input.nodes.every((elem, _index5) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
|
|
219
|
+
method: "typia.json.assertParse",
|
|
220
|
+
path: _path + ".nodes[" + _index5 + "]",
|
|
221
|
+
expected: "NodeWitness",
|
|
222
|
+
value: elem
|
|
223
|
+
}, _errorFactory)) && _ao1(elem, _path + ".nodes[" + _index5 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
224
|
+
method: "typia.json.assertParse",
|
|
225
|
+
path: _path + ".nodes[" + _index5 + "]",
|
|
226
|
+
expected: "NodeWitness",
|
|
227
|
+
value: elem
|
|
228
|
+
}, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
229
|
+
method: "typia.json.assertParse",
|
|
230
|
+
path: _path + ".nodes",
|
|
231
|
+
expected: "ReadonlyArray<NodeWitness>",
|
|
232
|
+
value: input.nodes
|
|
233
|
+
}, _errorFactory)) && ((Array.isArray(input.files) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
234
|
+
method: "typia.json.assertParse",
|
|
235
|
+
path: _path + ".files",
|
|
236
|
+
expected: "readonly { readonly path: string; readonly sha256: string; }[]",
|
|
237
|
+
value: input.files
|
|
238
|
+
}, _errorFactory)) && input.files.every((elem, _index6) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
|
|
239
|
+
method: "typia.json.assertParse",
|
|
240
|
+
path: _path + ".files[" + _index6 + "]",
|
|
241
|
+
expected: "{ readonly path: string; readonly sha256: string; }",
|
|
242
|
+
value: elem
|
|
243
|
+
}, _errorFactory)) && _ao2(elem, _path + ".files[" + _index6 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
244
|
+
method: "typia.json.assertParse",
|
|
245
|
+
path: _path + ".files[" + _index6 + "]",
|
|
246
|
+
expected: "{ readonly path: string; readonly sha256: string; }",
|
|
247
|
+
value: elem
|
|
248
|
+
}, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
249
|
+
method: "typia.json.assertParse",
|
|
250
|
+
path: _path + ".files",
|
|
251
|
+
expected: "readonly { readonly path: string; readonly sha256: string; }[]",
|
|
252
|
+
value: input.files
|
|
253
|
+
}, _errorFactory));
|
|
254
|
+
const _ao1 = (input, _path, _exceptionable = true) => _ap0(input, _path, true && _exceptionable) && ("string" === typeof input.stamp || _assertGuard_1._assertGuard(_exceptionable, {
|
|
255
|
+
method: "typia.json.assertParse",
|
|
256
|
+
path: _path + ".stamp",
|
|
257
|
+
expected: "string",
|
|
258
|
+
value: input.stamp
|
|
259
|
+
}, _errorFactory));
|
|
260
|
+
const _ao2 = (input, _path, _exceptionable = true) => _ap0(input, _path, true && _exceptionable) && ("string" === typeof input.sha256 || _assertGuard_1._assertGuard(_exceptionable, {
|
|
261
|
+
method: "typia.json.assertParse",
|
|
262
|
+
path: _path + ".sha256",
|
|
263
|
+
expected: "string",
|
|
264
|
+
value: input.sha256
|
|
265
|
+
}, _errorFactory));
|
|
266
|
+
const _io0 = input => Array.isArray(input.resolutions) && input.resolutions.every(elem => Array.isArray(elem) && (elem.length === 3 && "string" === typeof elem[0] && "string" === typeof elem[1] && (null === elem[2] || "string" === typeof elem[2]))) && (Array.isArray(input.nodes) && input.nodes.every(elem => "object" === typeof elem && null !== elem && _io1(elem))) && (Array.isArray(input.files) && input.files.every(elem => "object" === typeof elem && null !== elem && _io2(elem)));
|
|
267
|
+
const _io1 = input => _ip0(input) && "string" === typeof input.stamp;
|
|
268
|
+
const _io2 = input => _ip0(input) && "string" === typeof input.sha256;
|
|
269
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
270
|
+
let _errorFactory;
|
|
271
|
+
const __assert = (input, errorFactory) => {
|
|
272
|
+
if (false === __is(input)) {
|
|
273
|
+
_errorFactory = errorFactory;
|
|
274
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _assertGuard_1._assertGuard(true, {
|
|
275
|
+
method: "typia.json.assertParse",
|
|
276
|
+
path: _path + "",
|
|
277
|
+
expected: "GraphInstallationCensus",
|
|
278
|
+
value: input
|
|
279
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard_1._assertGuard(true, {
|
|
280
|
+
method: "typia.json.assertParse",
|
|
281
|
+
path: _path + "",
|
|
282
|
+
expected: "GraphInstallationCensus",
|
|
283
|
+
value: input
|
|
284
|
+
}, _errorFactory))(input, "$input", true);
|
|
285
|
+
}
|
|
286
|
+
return input;
|
|
287
|
+
};
|
|
288
|
+
return (input, errorFactory) => __assert(JSON.parse(input), errorFactory);
|
|
289
|
+
})()(census);
|
|
290
|
+
return new Set([
|
|
291
|
+
...nodes.map(({ path, stamp }) => `${path} ${stamp}`),
|
|
292
|
+
...files.map(({ path, sha256 }) => `${path} ${sha256}`),
|
|
293
|
+
]);
|
|
294
|
+
};
|
|
295
|
+
const made = entries(identity);
|
|
296
|
+
const now = entries(retired);
|
|
297
|
+
const changed = [
|
|
298
|
+
...[...made].filter((entry) => !now.has(entry)).map((entry) => `- ${entry}`),
|
|
299
|
+
...[...now].filter((entry) => !made.has(entry)).map((entry) => `+ ${entry}`),
|
|
300
|
+
];
|
|
301
|
+
throw new Error(`a fixture changed the installation it shares, in ${root}:\n${changed.slice(0, 20).join('\n')}`);
|
|
302
|
+
}
|
|
303
|
+
finally {
|
|
304
|
+
await rm(root, { recursive: true, force: true });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The installation one test file owns: a copy of the closure `censusRoot` (the workspace whose Nx, plugin and
|
|
309
|
+
* TypeScript the fixtures stand for) resolves, made in the empty directory `makeRoot` creates on first use. Call once
|
|
310
|
+
* per file, at module scope: Bun runs many test files in one process, and each must own its copy.
|
|
311
|
+
*/
|
|
312
|
+
export function ownedInstallation(censusRoot, makeRoot) {
|
|
313
|
+
let made;
|
|
314
|
+
return {
|
|
315
|
+
nodeModules: async () => {
|
|
316
|
+
made ??= makeRoot().then((root) => makeOwnedInstallation(censusRoot, root));
|
|
317
|
+
return join((await made).root, 'node_modules');
|
|
318
|
+
},
|
|
319
|
+
retire: async () => {
|
|
320
|
+
if (made !== undefined)
|
|
321
|
+
await retireOwnedInstallation(await made);
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"producer-receipts.d.ts","sourceRoot":"","sources":["../src/producer-receipts.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAEnH,OAAO,EAEL,KAAK,0BAA0B,EAE/B,KAAK,kBAAkB,EAIxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AAUnC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;CACrE;
|
|
1
|
+
{"version":3,"file":"producer-receipts.d.ts","sourceRoot":"","sources":["../src/producer-receipts.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAEnH,OAAO,EAEL,KAAK,0BAA0B,EAE/B,KAAK,kBAAkB,EAIxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AAUnC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ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