@unotest/core 0.10.0 → 0.11.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 +23 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +38 -0
- package/package.json +3 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@unotest/core` are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.11.0] - 2026-08-13
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- eb568a6: `e2e` CLI argument diagnostics: extra positional arguments are rejected
|
|
10
|
+
instead of silently ignored (with a "did you mean: unotest-web e2e <name>"
|
|
11
|
+
hint for a duplicated subcommand); an argument that resolves to a
|
|
12
|
+
directory gets its own message instead of the misleading ".js extension"
|
|
13
|
+
error; unknown scenario names now suggest close matches from
|
|
14
|
+
`unotest/e2e/**` (new `suggestClosest` / `levenshteinDistance` utilities
|
|
15
|
+
in `@unotest/core`). The `collection` command also rejects extra
|
|
16
|
+
positionals.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [a195713]
|
|
21
|
+
- Updated dependencies [ce25926]
|
|
22
|
+
- Updated dependencies [5a8e92b]
|
|
23
|
+
- Updated dependencies [d0ae620]
|
|
24
|
+
- Updated dependencies [2a68997]
|
|
25
|
+
- @unotest/protocol@0.11.0
|
|
26
|
+
- @unotest/dsl@0.11.0
|
|
27
|
+
|
|
5
28
|
## [0.10.0] - 2026-08-06
|
|
6
29
|
|
|
7
30
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -213,6 +213,12 @@ interface E2EFlags {
|
|
|
213
213
|
}
|
|
214
214
|
declare function parseE2EFlags(args: string[]): E2EFlags;
|
|
215
215
|
|
|
216
|
+
/** Classic two-row edit distance. Case-sensitive; callers normalise. */
|
|
217
|
+
declare function levenshteinDistance(a: string, b: string): number;
|
|
218
|
+
/** Candidates close enough to `input` to be worth suggesting, best
|
|
219
|
+
* match first. Empty when nothing is plausibly a typo of the input. */
|
|
220
|
+
declare function suggestClosest(input: string, candidates: readonly string[], max?: number): string[];
|
|
221
|
+
|
|
216
222
|
declare function readDebuggerBreakpoints(cwd: string, suffix: string, scenarioName: string): string[];
|
|
217
223
|
|
|
218
224
|
interface GitignoreUpdate {
|
|
@@ -237,4 +243,4 @@ declare function readEnvLayers(projectRoot: string, suffix: string, envName?: st
|
|
|
237
243
|
*/
|
|
238
244
|
declare function applyEnvLayers(projectRoot: string, suffix: string, target?: NodeJS.ProcessEnv): string[];
|
|
239
245
|
|
|
240
|
-
export { type ArtifactRedactor, type DebugCommandsWatcherDeps, type DebugControlTarget, type DebugWatcherLogger, type E2EFlags, type GitignoreUpdate, type IRunArtifactWriter, JsonlRunArtifactWriter, type JsonlRunArtifactWriterOptions, type RuntimeExecState, type RuntimeInspection, type RuntimeInspectionInput, type RuntimeStateExtra, type RuntimeStateWriter, type RuntimeStateWriterDeps, type WriteManifestInput, type WriteRunSourcesInput, appendUniqueLines, applyEnvLayers, buildRuntimeInspection, createRunArtifactWriter, createRuntimeStateWriter, currentLocation, extractCallStack, parseE2EFlags, readDebuggerBreakpoints, readEnvFile, readEnvLayers, startDebugCommandsWatcher, toProtocolRuntimeState, writeRunManifest, writeRunSources };
|
|
246
|
+
export { type ArtifactRedactor, type DebugCommandsWatcherDeps, type DebugControlTarget, type DebugWatcherLogger, type E2EFlags, type GitignoreUpdate, type IRunArtifactWriter, JsonlRunArtifactWriter, type JsonlRunArtifactWriterOptions, type RuntimeExecState, type RuntimeInspection, type RuntimeInspectionInput, type RuntimeStateExtra, type RuntimeStateWriter, type RuntimeStateWriterDeps, type WriteManifestInput, type WriteRunSourcesInput, appendUniqueLines, applyEnvLayers, buildRuntimeInspection, createRunArtifactWriter, createRuntimeStateWriter, currentLocation, extractCallStack, levenshteinDistance, parseE2EFlags, readDebuggerBreakpoints, readEnvFile, readEnvLayers, startDebugCommandsWatcher, suggestClosest, toProtocolRuntimeState, writeRunManifest, writeRunSources };
|
package/dist/index.js
CHANGED
|
@@ -428,6 +428,42 @@ function pushBreaks(value, out) {
|
|
|
428
428
|
}
|
|
429
429
|
__name(pushBreaks, "pushBreaks");
|
|
430
430
|
|
|
431
|
+
// src/fuzzy-match.ts
|
|
432
|
+
function levenshteinDistance(a, b) {
|
|
433
|
+
if (a === b) return 0;
|
|
434
|
+
if (a.length === 0) return b.length;
|
|
435
|
+
if (b.length === 0) return a.length;
|
|
436
|
+
let prev = [];
|
|
437
|
+
let curr = [];
|
|
438
|
+
for (let j = 0; j <= b.length; j++) prev.push(j);
|
|
439
|
+
for (let i = 1; i <= a.length; i++) {
|
|
440
|
+
curr = [i];
|
|
441
|
+
for (let j = 1; j <= b.length; j++) {
|
|
442
|
+
const substitution = prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1);
|
|
443
|
+
curr.push(Math.min(substitution, prev[j] + 1, curr[j - 1] + 1));
|
|
444
|
+
}
|
|
445
|
+
prev = curr;
|
|
446
|
+
}
|
|
447
|
+
return prev[b.length];
|
|
448
|
+
}
|
|
449
|
+
__name(levenshteinDistance, "levenshteinDistance");
|
|
450
|
+
var CLOSE_ENOUGH = 0.34;
|
|
451
|
+
function normalizedDistance(input, candidate) {
|
|
452
|
+
const whole = levenshteinDistance(input, candidate) / Math.max(input.length, candidate.length);
|
|
453
|
+
const lastSegment = candidate.slice(candidate.lastIndexOf("/") + 1);
|
|
454
|
+
const segment = levenshteinDistance(input, lastSegment) / Math.max(input.length, lastSegment.length);
|
|
455
|
+
return Math.min(whole, segment);
|
|
456
|
+
}
|
|
457
|
+
__name(normalizedDistance, "normalizedDistance");
|
|
458
|
+
function suggestClosest(input, candidates, max = 3) {
|
|
459
|
+
const needle = input.toLowerCase();
|
|
460
|
+
return candidates.map((candidate) => ({
|
|
461
|
+
candidate,
|
|
462
|
+
distance: normalizedDistance(needle, candidate.toLowerCase())
|
|
463
|
+
})).filter(({ distance }) => distance <= CLOSE_ENOUGH).sort((x, y) => x.distance - y.distance || x.candidate.localeCompare(y.candidate)).slice(0, max).map(({ candidate }) => candidate);
|
|
464
|
+
}
|
|
465
|
+
__name(suggestClosest, "suggestClosest");
|
|
466
|
+
|
|
431
467
|
// src/debugger-file.ts
|
|
432
468
|
import { debuggerFileFor } from "@unotest/protocol";
|
|
433
469
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -519,11 +555,13 @@ export {
|
|
|
519
555
|
createRuntimeStateWriter,
|
|
520
556
|
currentLocation,
|
|
521
557
|
extractCallStack,
|
|
558
|
+
levenshteinDistance,
|
|
522
559
|
parseE2EFlags,
|
|
523
560
|
readDebuggerBreakpoints,
|
|
524
561
|
readEnvFile,
|
|
525
562
|
readEnvLayers,
|
|
526
563
|
startDebugCommandsWatcher,
|
|
564
|
+
suggestClosest,
|
|
527
565
|
toProtocolRuntimeState,
|
|
528
566
|
writeRunManifest,
|
|
529
567
|
writeRunSources
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unotest/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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,22 +29,13 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"chokidar": "^4.0.3",
|
|
32
|
-
"@unotest/
|
|
33
|
-
"@unotest/
|
|
32
|
+
"@unotest/protocol": "^0.11.0",
|
|
33
|
+
"@unotest/dsl": "^0.11.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.10.0",
|
|
37
37
|
"tsup": "^8.5.1",
|
|
38
38
|
"tsx": "^4.19.2",
|
|
39
39
|
"typescript": "^5.7.2"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"typecheck": "tsc --noEmit",
|
|
43
|
-
"test": "node --import tsx --test --test-reporter=spec 'src/**/*.test.ts'",
|
|
44
|
-
"compile": "tsup",
|
|
45
|
-
"verify": "pnpm typecheck && pnpm check:no-cyrillic && pnpm test",
|
|
46
|
-
"build": "pnpm verify && pnpm compile && pnpm check:tarball",
|
|
47
|
-
"check:no-cyrillic": "node scripts/check-no-cyrillic.mjs",
|
|
48
|
-
"check:tarball": "node scripts/check-tarball.mjs"
|
|
49
40
|
}
|
|
50
41
|
}
|