@unotest/core 0.30.0 → 0.31.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/CHANGELOG.md +28 -0
- package/dist/index.d.ts +20 -3
- package/dist/index.js +24 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.31.0] - 2026-09-04
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 100ab9d: `buildRuntimeInspection` keeps `stepTag` and `soft` on `lastFailure` and
|
|
8
|
+
passes the runtime's `softFailures` list through into `runtime.json`, so
|
|
9
|
+
`inspect_runtime` and `run_test` can report the case a data-driven step
|
|
10
|
+
was on and every soft step that failed.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- b8e105b: `capUtf8(text, maxBytes)` — cut a string to a UTF-8 byte budget without
|
|
15
|
+
splitting a code point — exported next to `JOURNAL_TEXT_CAP_BYTES`
|
|
16
|
+
(4 KB). The runtime-state var snapshot now caps by bytes through it (it
|
|
17
|
+
used to count UTF-16 units); the run journal's `note` / `log` payloads
|
|
18
|
+
use the same cap.
|
|
19
|
+
- Updated dependencies [b8e105b]
|
|
20
|
+
- Updated dependencies [9ae6d59]
|
|
21
|
+
- Updated dependencies [56784b3]
|
|
22
|
+
- Updated dependencies [e048334]
|
|
23
|
+
- Updated dependencies [100ab9d]
|
|
24
|
+
- Updated dependencies [100ab9d]
|
|
25
|
+
- Updated dependencies [ad7c918]
|
|
26
|
+
- Updated dependencies [ad7c918]
|
|
27
|
+
- Updated dependencies [dcf4c9e]
|
|
28
|
+
- @unotest/protocol@0.31.0
|
|
29
|
+
- @unotest/dsl@0.31.0
|
|
30
|
+
|
|
3
31
|
## [0.30.0] - 2026-09-03
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RunArtifact, RunManifest, RunSources, RuntimeStateFile, RuntimeState, DbgCommand, PickerMode, DbgCommandRecord, DbgCommandProbe, IRunQueue, EnqueueRunInput, RunQueueTicketHandle, QueueSnapshot, QueueTicket, RunQueueLease, BundleGitInfo, BundleManifest, ScheduleEntry } from '@unotest/protocol';
|
|
1
|
+
import { RunArtifact, RunManifest, RunSources, RuntimeStateFile, SoftFailureRecord, RuntimeState, DbgCommand, PickerMode, DbgCommandRecord, DbgCommandProbe, IRunQueue, EnqueueRunInput, RunQueueTicketHandle, QueueSnapshot, QueueTicket, RunQueueLease, BundleGitInfo, BundleManifest, ScheduleEntry } from '@unotest/protocol';
|
|
2
2
|
export { isRecord } from '@unotest/protocol';
|
|
3
3
|
import { ExecutionEvent } from '@unotest/dsl/executor';
|
|
4
4
|
|
|
@@ -91,7 +91,7 @@ type RuntimeExecState = "starting" | "running" | "paused-step" | "paused-failure
|
|
|
91
91
|
/** Normalized, protocol-shaped runtime view assembled from a manager snapshot.
|
|
92
92
|
* Feeds straight into `RuntimeStateFile` (the writer adds runId / wsEndpoint /
|
|
93
93
|
* wheel / updatedAt) — hence a Pick, not a re-spelled mirror. */
|
|
94
|
-
type RuntimeInspection = Pick<RuntimeStateFile, "scenario" | "testFn" | "state" | "current" | "vars" | "callStack" | "lastFailure">;
|
|
94
|
+
type RuntimeInspection = Pick<RuntimeStateFile, "scenario" | "testFn" | "state" | "current" | "vars" | "callStack" | "lastFailure" | "softFailures">;
|
|
95
95
|
/** Raw inputs from a `TestRuntimeManager.inspect()` snapshot, before
|
|
96
96
|
* protocol-normalization. `lastFailure` is the manager's richer record; only
|
|
97
97
|
* line/col/message survive into the protocol form. */
|
|
@@ -108,7 +108,13 @@ interface RuntimeInspectionInput {
|
|
|
108
108
|
message: string;
|
|
109
109
|
name?: string;
|
|
110
110
|
};
|
|
111
|
+
/** Evaluated `{tag}` of the enclosing `step(...)`, when any. */
|
|
112
|
+
stepTag?: string;
|
|
113
|
+
/** The failure sat inside a `step.soft(...)` — the run went on. */
|
|
114
|
+
soft?: boolean;
|
|
111
115
|
} | null;
|
|
116
|
+
/** Failed `step.soft(...)` blocks so far, in run order. */
|
|
117
|
+
softFailures?: readonly SoftFailureRecord[];
|
|
112
118
|
}
|
|
113
119
|
declare function buildRuntimeInspection(input: RuntimeInspectionInput, stringifyVar: (v: unknown) => string): RuntimeInspection;
|
|
114
120
|
declare function toProtocolRuntimeState(state: RuntimeExecState, lastEvent: ExecutionEvent | null): RuntimeState;
|
|
@@ -121,6 +127,17 @@ declare function extractCallStack(ev: ExecutionEvent | null): {
|
|
|
121
127
|
file: string;
|
|
122
128
|
line: number;
|
|
123
129
|
}[];
|
|
130
|
+
/** Cut `s` to at most `maxBytes` of UTF-8 without splitting a code point.
|
|
131
|
+
* Shared by the runtime-state var snapshot and the run journal's `note` /
|
|
132
|
+
* `log` events, so "what fits in a line" means one thing everywhere. */
|
|
133
|
+
declare function capUtf8(s: string, maxBytes: number): {
|
|
134
|
+
text: string;
|
|
135
|
+
truncated: boolean;
|
|
136
|
+
};
|
|
137
|
+
/** The journal's cap for one `note` / `log` payload — the same 4 KB the
|
|
138
|
+
* var snapshot uses: a small object or a response body fits, an HTML
|
|
139
|
+
* document does not. */
|
|
140
|
+
declare const JOURNAL_TEXT_CAP_BYTES = 4096;
|
|
124
141
|
|
|
125
142
|
/** Runner-specific extras merged into every snapshot. Evaluated on each write
|
|
126
143
|
* so live values (the current wheel owner) stay fresh. */
|
|
@@ -498,4 +515,4 @@ declare class BundleIdMismatchError extends UnotestError {
|
|
|
498
515
|
constructor(claimed: string, computed: string);
|
|
499
516
|
}
|
|
500
517
|
|
|
501
|
-
export { type ArtifactRedactor, type BundleFile, BundleFormatError, BundleIdMismatchError, BundlePathError, type BundleProvenance, BundleTooLargeError, type DebugCommandsWatcherDeps, type DebugControlTarget, type DebugWatcherLogger, type E2EFlags, FsRunQueue, type FsRunQueueOptions, type GitignoreUpdate, type GlobalPoolOptions, type IRunArtifactWriter, JsonlRunArtifactWriter, type JsonlRunArtifactWriterOptions, type PackedBundle, QueueTicketLostError, QueueUnavailableError, QueueWaitAbortedError, type RunHeartbeat, type RuntimeExecState, type RuntimeInspection, type RuntimeInspectionInput, type RuntimeStateExtra, type RuntimeStateWriter, type RuntimeStateWriterDeps, type TarEntry, UnotestError, type UnpackOptions, type UnpackedBundle, type WriteManifestInput, type WriteRunSourcesInput, appendUniqueLines, applyEnvLayers, assertSafeBundlePath, buildRuntimeInspection, computeBundleId, computeSchedulesFingerprint, computeTreeSha256, createRunArtifactWriter, createRuntimeStateWriter, currentLocation, extractCallStack, globalPoolFromEnv, leaseEnv, levenshteinDistance, packBundle, parseE2EFlags, readDebuggerBreakpoints, readEnvFile, readEnvLayers, readTar, startDebugCommandsWatcher, startRunHeartbeat, suggestClosest, toProtocolRuntimeState, unpackBundle, writeRunManifest, writeRunSources, writeTar };
|
|
518
|
+
export { type ArtifactRedactor, type BundleFile, BundleFormatError, BundleIdMismatchError, BundlePathError, type BundleProvenance, BundleTooLargeError, type DebugCommandsWatcherDeps, type DebugControlTarget, type DebugWatcherLogger, type E2EFlags, FsRunQueue, type FsRunQueueOptions, type GitignoreUpdate, type GlobalPoolOptions, type IRunArtifactWriter, JOURNAL_TEXT_CAP_BYTES, JsonlRunArtifactWriter, type JsonlRunArtifactWriterOptions, type PackedBundle, QueueTicketLostError, QueueUnavailableError, QueueWaitAbortedError, type RunHeartbeat, type RuntimeExecState, type RuntimeInspection, type RuntimeInspectionInput, type RuntimeStateExtra, type RuntimeStateWriter, type RuntimeStateWriterDeps, type TarEntry, UnotestError, type UnpackOptions, type UnpackedBundle, type WriteManifestInput, type WriteRunSourcesInput, appendUniqueLines, applyEnvLayers, assertSafeBundlePath, buildRuntimeInspection, capUtf8, computeBundleId, computeSchedulesFingerprint, computeTreeSha256, createRunArtifactWriter, createRuntimeStateWriter, currentLocation, extractCallStack, globalPoolFromEnv, leaseEnv, levenshteinDistance, packBundle, parseE2EFlags, readDebuggerBreakpoints, readEnvFile, readEnvLayers, readTar, startDebugCommandsWatcher, startRunHeartbeat, suggestClosest, toProtocolRuntimeState, unpackBundle, writeRunManifest, writeRunSources, writeTar };
|
package/dist/index.js
CHANGED
|
@@ -171,8 +171,11 @@ function buildRuntimeInspection(input, stringifyVar) {
|
|
|
171
171
|
lastFailure: input.lastFailure ? {
|
|
172
172
|
line: input.lastFailure.line,
|
|
173
173
|
col: input.lastFailure.col,
|
|
174
|
-
error: { message: input.lastFailure.error.message }
|
|
175
|
-
|
|
174
|
+
error: { message: input.lastFailure.error.message },
|
|
175
|
+
...input.lastFailure.stepTag !== void 0 ? { stepTag: input.lastFailure.stepTag } : {},
|
|
176
|
+
...input.lastFailure.soft ? { soft: true } : {}
|
|
177
|
+
} : null,
|
|
178
|
+
...input.softFailures && input.softFailures.length > 0 ? { softFailures: input.softFailures.map((f) => ({ ...f })) } : {}
|
|
176
179
|
};
|
|
177
180
|
}
|
|
178
181
|
__name(buildRuntimeInspection, "buildRuntimeInspection");
|
|
@@ -227,10 +230,25 @@ function serializeVars(vars, stringifyVar) {
|
|
|
227
230
|
}
|
|
228
231
|
__name(serializeVars, "serializeVars");
|
|
229
232
|
function truncate(s) {
|
|
230
|
-
|
|
231
|
-
return
|
|
233
|
+
const capped = capUtf8(s, VAR_TRUNCATE_BYTES);
|
|
234
|
+
return capped.truncated ? `${capped.text}\u2026` : capped.text;
|
|
232
235
|
}
|
|
233
236
|
__name(truncate, "truncate");
|
|
237
|
+
function capUtf8(s, maxBytes) {
|
|
238
|
+
const encoder = new TextEncoder();
|
|
239
|
+
if (encoder.encode(s).byteLength <= maxBytes) return { text: s, truncated: false };
|
|
240
|
+
let bytes = 0;
|
|
241
|
+
let end = 0;
|
|
242
|
+
for (const ch of s) {
|
|
243
|
+
const size = encoder.encode(ch).byteLength;
|
|
244
|
+
if (bytes + size > maxBytes) break;
|
|
245
|
+
bytes += size;
|
|
246
|
+
end += ch.length;
|
|
247
|
+
}
|
|
248
|
+
return { text: s.slice(0, end), truncated: true };
|
|
249
|
+
}
|
|
250
|
+
__name(capUtf8, "capUtf8");
|
|
251
|
+
var JOURNAL_TEXT_CAP_BYTES = VAR_TRUNCATE_BYTES;
|
|
234
252
|
|
|
235
253
|
// src/runtime-state-writer.ts
|
|
236
254
|
import { RUNTIME_FILE } from "@unotest/protocol";
|
|
@@ -1578,6 +1596,7 @@ export {
|
|
|
1578
1596
|
BundlePathError,
|
|
1579
1597
|
BundleTooLargeError,
|
|
1580
1598
|
FsRunQueue,
|
|
1599
|
+
JOURNAL_TEXT_CAP_BYTES,
|
|
1581
1600
|
JsonlRunArtifactWriter,
|
|
1582
1601
|
QueueTicketLostError,
|
|
1583
1602
|
QueueUnavailableError,
|
|
@@ -1587,6 +1606,7 @@ export {
|
|
|
1587
1606
|
applyEnvLayers,
|
|
1588
1607
|
assertSafeBundlePath,
|
|
1589
1608
|
buildRuntimeInspection,
|
|
1609
|
+
capUtf8,
|
|
1590
1610
|
computeBundleId,
|
|
1591
1611
|
computeSchedulesFingerprint,
|
|
1592
1612
|
computeTreeSha256,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unotest/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Shared runner-side utilities for the @unotest ecosystem: JSONL run-artifact writer (steps.jsonl + heartbeat), atomic run-manifest + run-sources writers, atomic runtime-state writer with a protocol-normalizing runtime-inspection helper, layered .env reader/applier (target + environment axes), idempotent .gitignore updater. Used by @unotest/web and @unotest/mobile; depends on @unotest/protocol plus a type-only import of @unotest/dsl/executor event types (M-20). Unlike protocol (pure data), this package owns the thin filesystem layer both runners need.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"chokidar": "^4.0.3",
|
|
32
|
-
"@unotest/
|
|
33
|
-
"@unotest/
|
|
32
|
+
"@unotest/protocol": "^0.31.0",
|
|
33
|
+
"@unotest/dsl": "^0.31.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.10.0",
|