obsidian-integration-testing 9.1.0 → 9.2.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/README.md +106 -13
- package/dist/lib/cjs/connect-to-cdp.cjs +23 -2
- package/dist/lib/cjs/global-setup-core.cjs +44 -1
- package/dist/lib/cjs/index.cjs +12 -1
- package/dist/lib/cjs/index.d.cts +5 -0
- package/dist/lib/cjs/leftover-cleanup.cjs +116 -0
- package/dist/lib/cjs/leftover-cleanup.d.cts +163 -0
- package/dist/lib/cjs/library.cjs +1 -1
- package/dist/lib/cjs/obsidian-metadata.cjs +15 -1
- package/dist/lib/cjs/run-version-matrix.cjs +64 -0
- package/dist/lib/cjs/run-version-matrix.d.cts +49 -0
- package/dist/lib/cjs/setup-lock.cjs +145 -32
- package/dist/lib/cjs/setup-lock.d.cts +9 -3
- package/dist/lib/cjs/temp-vault.cjs +3 -2
- package/dist/lib/cjs/transport-appium.cjs +86 -30
- package/dist/lib/cjs/transport-appium.d.cts +43 -3
- package/dist/lib/cjs/transport-factory.cjs +52 -4
- package/dist/lib/cjs/transport-options.cjs +1 -1
- package/dist/lib/cjs/transport-options.d.cts +57 -0
- package/dist/lib/cjs/version-matrix.cjs +175 -0
- package/dist/lib/cjs/version-matrix.d.cts +224 -0
- package/dist/lib/esm/connect-to-cdp.mjs +27 -2
- package/dist/lib/esm/global-setup-core.mjs +52 -2
- package/dist/lib/esm/index.d.mts +5 -0
- package/dist/lib/esm/index.mjs +11 -1
- package/dist/lib/esm/leftover-cleanup.d.mts +163 -0
- package/dist/lib/esm/leftover-cleanup.mjs +88 -0
- package/dist/lib/esm/library.mjs +1 -1
- package/dist/lib/esm/obsidian-metadata.mjs +15 -1
- package/dist/lib/esm/run-version-matrix.d.mts +49 -0
- package/dist/lib/esm/run-version-matrix.mjs +48 -0
- package/dist/lib/esm/setup-lock.d.mts +9 -3
- package/dist/lib/esm/setup-lock.mjs +145 -32
- package/dist/lib/esm/temp-vault.mjs +3 -2
- package/dist/lib/esm/transport-appium.d.mts +43 -3
- package/dist/lib/esm/transport-appium.mjs +84 -29
- package/dist/lib/esm/transport-factory.mjs +62 -5
- package/dist/lib/esm/transport-options.d.mts +57 -0
- package/dist/lib/esm/version-matrix.d.mts +224 -0
- package/dist/lib/esm/version-matrix.mjs +147 -0
- package/dist/obsidian-integration-testing-9.2.0.tgz +0 -0
- package/package.json +18 -25
- package/dist/obsidian-integration-testing-9.1.0.tgz +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
*
|
|
4
|
+
* Sweeps the temporary directories a previous integration run leaked — the
|
|
5
|
+
* `temp-vault-*` staging/vault directories and the owned instance's
|
|
6
|
+
* `userdata-*` Chromium profiles.
|
|
7
|
+
*
|
|
8
|
+
* A run that dies mid-flight cannot clean up after itself: on Android the
|
|
9
|
+
* teardown talks to the WebView, and a dead WebView is exactly what most
|
|
10
|
+
* failures are (`Vault cleanup error (non-fatal): no such window`). Every
|
|
11
|
+
* failure therefore leaks a vault, every leaked vault stays registered for
|
|
12
|
+
* Obsidian to enumerate at startup, and that enumeration has to finish inside
|
|
13
|
+
* the WebView-readiness budget — so each failure makes the next one likelier.
|
|
14
|
+
* Sweeping foreign residue at the START of a run breaks that loop, because it
|
|
15
|
+
* runs before anything that can die.
|
|
16
|
+
*
|
|
17
|
+
* The two sides use deliberately different safety gates (see the repo's L31):
|
|
18
|
+
*
|
|
19
|
+
* - **Device (Android)** — unconditional. Android runs hold the exclusive
|
|
20
|
+
* `android` setup lock, so no concurrent run can own a device vault, and an
|
|
21
|
+
* age gate would let a vault leaked ten minutes ago survive into the next run.
|
|
22
|
+
* - **Host** — age-gated. Desktop runs are deliberately *not* serialized (each
|
|
23
|
+
* owns an isolated instance) and every project on the machine shares one
|
|
24
|
+
* `tmpdir()`, so a directory young enough to belong to a live run is left
|
|
25
|
+
* alone.
|
|
26
|
+
*/
|
|
27
|
+
import type { ObsidianTransportOptions } from './transport-options.cjs';
|
|
28
|
+
/**
|
|
29
|
+
* Default for the `leftoverMaxAgeInMilliseconds` transport option — two hours.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_LEFTOVER_MAX_AGE_IN_MILLISECONDS = 7200000;
|
|
32
|
+
/**
|
|
33
|
+
* Name of the harness's own directory inside {@link tmpdir}, which holds the
|
|
34
|
+
* owned instances' user-data directories alongside the version/installer caches
|
|
35
|
+
* and the setup locks.
|
|
36
|
+
*/
|
|
37
|
+
export declare const HARNESS_TEMP_DIR_NAME = "obsidian-integration-testing";
|
|
38
|
+
/**
|
|
39
|
+
* Prefix of an owned desktop instance's isolated user-data directory.
|
|
40
|
+
*/
|
|
41
|
+
export declare const OWNED_USER_DATA_DIR_PREFIX = "userdata-";
|
|
42
|
+
/**
|
|
43
|
+
* Prefix of a temporary vault directory, both on the host (where it is created)
|
|
44
|
+
* and on an Android device (where it keeps its host basename).
|
|
45
|
+
*/
|
|
46
|
+
export declare const TEMP_VAULT_DIR_PREFIX = "temp-vault-";
|
|
47
|
+
/**
|
|
48
|
+
* Parameters for {@link checkIsLeftoverStale}.
|
|
49
|
+
*/
|
|
50
|
+
export interface CheckIsLeftoverStaleParams {
|
|
51
|
+
/**
|
|
52
|
+
* How old an entry must be to count as stale. `0` disables the gate, making
|
|
53
|
+
* every entry stale.
|
|
54
|
+
*/
|
|
55
|
+
readonly maxAgeInMilliseconds: number;
|
|
56
|
+
/** The entry's modification time, in epoch milliseconds. */
|
|
57
|
+
readonly modifiedAtInMilliseconds: number;
|
|
58
|
+
/** The current time, in epoch milliseconds. */
|
|
59
|
+
readonly nowInMilliseconds: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parameters for {@link filterLeftoverNames}.
|
|
63
|
+
*/
|
|
64
|
+
export interface FilterLeftoverNamesParams {
|
|
65
|
+
/** Names to keep even when they match a prefix (e.g. the current run's own vault). */
|
|
66
|
+
readonly excludedNames?: readonly string[] | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Raw entry names. Accepts `adb shell ls` output split into lines, so each
|
|
69
|
+
* name is trimmed (dropping the trailing `\r` an `adb` shell adds on Windows)
|
|
70
|
+
* and blank lines are dropped.
|
|
71
|
+
*/
|
|
72
|
+
readonly names: readonly string[];
|
|
73
|
+
/** Directory-name prefixes that mark an entry as the harness's own residue. */
|
|
74
|
+
readonly prefixes: readonly string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A directory the host sweep scans, together with the prefixes that mark
|
|
78
|
+
* residue inside it.
|
|
79
|
+
*/
|
|
80
|
+
export interface LeftoverRoot {
|
|
81
|
+
/** The absolute path to scan. */
|
|
82
|
+
readonly path: string;
|
|
83
|
+
/** Directory-name prefixes that mark an entry as removable residue. */
|
|
84
|
+
readonly prefixes: readonly string[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Options for {@link sweepHostLeftovers}.
|
|
88
|
+
*/
|
|
89
|
+
export interface SweepHostLeftoversOptions {
|
|
90
|
+
/** Names to keep regardless of age (e.g. the current run's own directories). */
|
|
91
|
+
readonly excludedNames?: readonly string[] | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* How old a directory must be before it is removed. `0` removes every match.
|
|
94
|
+
*
|
|
95
|
+
* @default {@link DEFAULT_LEFTOVER_MAX_AGE_IN_MILLISECONDS}
|
|
96
|
+
*/
|
|
97
|
+
readonly maxAgeInMilliseconds?: number | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* The roots to sweep. Defaults to the temp-vault root ({@link tmpdir}) and the
|
|
100
|
+
* owned user-data root (`<tmpdir>/{@link HARNESS_TEMP_DIR_NAME}`).
|
|
101
|
+
*/
|
|
102
|
+
readonly roots?: readonly LeftoverRoot[] | undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Result of {@link sweepHostLeftovers}.
|
|
106
|
+
*/
|
|
107
|
+
export interface SweepHostLeftoversResult {
|
|
108
|
+
/** How many directories were selected for removal but could not be removed. */
|
|
109
|
+
readonly failedCount: number;
|
|
110
|
+
/** How many directories were removed. */
|
|
111
|
+
readonly removedCount: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Decides whether a leftover entry is old enough to be removed.
|
|
115
|
+
*
|
|
116
|
+
* The gate exists because every project on the machine shares one `tmpdir()`
|
|
117
|
+
* and desktop runs are not serialized, so a young directory may well belong to
|
|
118
|
+
* a run that is still in flight. An entry whose modification time is in the
|
|
119
|
+
* future (a clock skew) is treated as live for the same reason.
|
|
120
|
+
*
|
|
121
|
+
* @param params - The age comparison inputs.
|
|
122
|
+
* @returns `true` when the entry may be removed.
|
|
123
|
+
*/
|
|
124
|
+
export declare function checkIsLeftoverStale(params: CheckIsLeftoverStaleParams): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Selects the entry names that are the harness's own residue.
|
|
127
|
+
*
|
|
128
|
+
* Name-only, so the caller can filter a large directory listing before paying
|
|
129
|
+
* for a `stat` per entry, and so the Android sweep can feed it raw
|
|
130
|
+
* `adb shell ls` output.
|
|
131
|
+
*
|
|
132
|
+
* @param params - The names, prefixes, and exclusions.
|
|
133
|
+
* @returns The matching names, trimmed.
|
|
134
|
+
*/
|
|
135
|
+
export declare function filterLeftoverNames(params: FilterLeftoverNamesParams): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Resolves the leftover age gate, applying the default when the option is
|
|
138
|
+
* omitted.
|
|
139
|
+
*
|
|
140
|
+
* @param options - The transport options.
|
|
141
|
+
* @returns The max age in milliseconds (`0` disables the gate).
|
|
142
|
+
*/
|
|
143
|
+
export declare function resolveLeftoverMaxAgeInMilliseconds(options: ObsidianTransportOptions | undefined): number;
|
|
144
|
+
/**
|
|
145
|
+
* Resolves whether leftover directories are swept, applying the default when
|
|
146
|
+
* the option is omitted.
|
|
147
|
+
*
|
|
148
|
+
* @param options - The transport options.
|
|
149
|
+
* @returns `true` when the sweeps should run.
|
|
150
|
+
*/
|
|
151
|
+
export declare function resolveShouldSweepLeftovers(options: ObsidianTransportOptions | undefined): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Removes the host-side directories left behind by earlier runs.
|
|
154
|
+
*
|
|
155
|
+
* Best-effort throughout: an unreadable root, an entry that cannot be `stat`ed,
|
|
156
|
+
* and a directory that refuses to be removed (a live process still holding a
|
|
157
|
+
* handle answers `EPERM` on Windows) are all skipped rather than thrown, so a
|
|
158
|
+
* sweep can never fail the run it is cleaning up for.
|
|
159
|
+
*
|
|
160
|
+
* @param options - The sweep options.
|
|
161
|
+
* @returns How many directories were removed, and how many resisted removal.
|
|
162
|
+
*/
|
|
163
|
+
export declare function sweepHostLeftovers(options?: SweepHostLeftoversOptions): Promise<SweepHostLeftoversResult>;
|
package/dist/lib/cjs/library.cjs
CHANGED
|
@@ -21,7 +21,7 @@ __export(library_exports, {
|
|
|
21
21
|
LIBRARY_VERSION: () => LIBRARY_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(library_exports);
|
|
24
|
-
const LIBRARY_VERSION = false ? "dev" : "9.
|
|
24
|
+
const LIBRARY_VERSION = false ? "dev" : "9.1.1";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIBRARY_VERSION
|