@ricsam/isolate-client 0.1.7 → 0.1.9
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 +3 -3
- package/dist/cjs/connection.cjs +72 -6
- package/dist/cjs/connection.cjs.map +3 -3
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/connection.mjs +72 -6
- package/dist/mjs/connection.mjs.map +3 -3
- package/dist/mjs/package.json +1 -1
- package/dist/types/types.d.ts +7 -124
- package/package.json +1 -1
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types for the isolate client.
|
|
3
3
|
*/
|
|
4
|
-
import type { RunTestsResult, TestResult as ProtocolTestResult, TestInfo as ProtocolTestInfo, TestError as ProtocolTestError, TestEvent as ProtocolTestEvent, SuiteInfo as ProtocolSuiteInfo, SuiteResult as ProtocolSuiteResult, CollectedData as ProtocolCollectedData, ConsoleEntry as ProtocolConsoleEntry, PlaywrightEvent as ProtocolPlaywrightEvent, CustomFunctionType } from "@ricsam/isolate-protocol";
|
|
4
|
+
import type { RunTestsResult, TestResult as ProtocolTestResult, TestInfo as ProtocolTestInfo, TestError as ProtocolTestError, TestEvent as ProtocolTestEvent, SuiteInfo as ProtocolSuiteInfo, SuiteResult as ProtocolSuiteResult, CollectedData as ProtocolCollectedData, ConsoleEntry as ProtocolConsoleEntry, PlaywrightEvent as ProtocolPlaywrightEvent, CustomFunctionType, EvalOptions as ProtocolEvalOptions, TestEnvironmentOptions as ProtocolTestEnvironmentOptions, PlaywrightOptions as ProtocolPlaywrightOptions, BaseRuntimeOptions, ConsoleCallbacks, FetchCallback, FileSystemCallbacks, ModuleLoaderCallback, CustomFunction, CustomAsyncGeneratorFunction, CustomFunctionDefinition, CustomFunctions, DispatchOptions } from "@ricsam/isolate-protocol";
|
|
5
5
|
export type RunResults = RunTestsResult;
|
|
6
6
|
export type TestResult = ProtocolTestResult;
|
|
7
7
|
export type TestInfo = ProtocolTestInfo;
|
|
@@ -12,6 +12,10 @@ export type SuiteResult = ProtocolSuiteResult;
|
|
|
12
12
|
export type CollectedData = ProtocolCollectedData;
|
|
13
13
|
export type ConsoleEntry = ProtocolConsoleEntry;
|
|
14
14
|
export type PlaywrightEvent = ProtocolPlaywrightEvent;
|
|
15
|
+
export type EvalOptions = ProtocolEvalOptions;
|
|
16
|
+
export type TestEnvironmentOptions = ProtocolTestEnvironmentOptions;
|
|
17
|
+
export type PlaywrightOptions = ProtocolPlaywrightOptions;
|
|
18
|
+
export type { ConsoleCallbacks, FetchCallback, FileSystemCallbacks, ModuleLoaderCallback, CustomFunction, CustomAsyncGeneratorFunction, CustomFunctionDefinition, CustomFunctions, CustomFunctionType, DispatchOptions, };
|
|
15
19
|
/**
|
|
16
20
|
* Options for connecting to the daemon.
|
|
17
21
|
*/
|
|
@@ -48,127 +52,13 @@ export interface DaemonConnection {
|
|
|
48
52
|
/** Check if connected */
|
|
49
53
|
isConnected(): boolean;
|
|
50
54
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Test environment options for createRuntime.
|
|
53
|
-
*/
|
|
54
|
-
export interface TestEnvironmentOptions {
|
|
55
|
-
/** Receive test lifecycle events */
|
|
56
|
-
onEvent?: (event: TestEvent) => void;
|
|
57
|
-
/** Timeout for individual tests (ms) */
|
|
58
|
-
testTimeout?: number;
|
|
59
|
-
}
|
|
60
55
|
/**
|
|
61
56
|
* Options for creating a runtime.
|
|
57
|
+
* Extends BaseRuntimeOptions and adds client-specific fs type.
|
|
62
58
|
*/
|
|
63
|
-
export interface RuntimeOptions {
|
|
64
|
-
/** Memory limit in megabytes (optional) */
|
|
65
|
-
memoryLimitMB?: number;
|
|
66
|
-
/** Console callback handlers */
|
|
67
|
-
console?: ConsoleCallbacks;
|
|
68
|
-
/** Fetch callback handler */
|
|
69
|
-
fetch?: FetchCallback;
|
|
59
|
+
export interface RuntimeOptions<T extends Record<string, any[]> = Record<string, unknown[]>> extends BaseRuntimeOptions<T> {
|
|
70
60
|
/** File system callback handlers */
|
|
71
61
|
fs?: FileSystemCallbacks;
|
|
72
|
-
/** Module loader callback for resolving dynamic imports */
|
|
73
|
-
moduleLoader?: ModuleLoaderCallback;
|
|
74
|
-
/** Custom functions callable from within the isolate */
|
|
75
|
-
customFunctions?: CustomFunctions;
|
|
76
|
-
/** Current working directory for path.resolve(). Defaults to "/" */
|
|
77
|
-
cwd?: string;
|
|
78
|
-
/** Enable test environment (describe, it, expect, etc.) */
|
|
79
|
-
testEnvironment?: boolean | TestEnvironmentOptions;
|
|
80
|
-
/** Playwright options - user provides page */
|
|
81
|
-
playwright?: PlaywrightOptions;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Options for Playwright integration.
|
|
85
|
-
* User provides the page object - client owns the browser.
|
|
86
|
-
*/
|
|
87
|
-
export interface PlaywrightOptions {
|
|
88
|
-
/** Playwright page object */
|
|
89
|
-
page: import("playwright").Page;
|
|
90
|
-
/** Default timeout for operations in ms */
|
|
91
|
-
timeout?: number;
|
|
92
|
-
/** Base URL for navigation */
|
|
93
|
-
baseUrl?: string;
|
|
94
|
-
/** If true, browser console logs are routed through console handler (or printed to stdout if no handler) */
|
|
95
|
-
console?: boolean;
|
|
96
|
-
/** Unified event callback for all playwright events */
|
|
97
|
-
onEvent?: (event: PlaywrightEvent) => void;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Console callback handlers with single structured callback.
|
|
101
|
-
*/
|
|
102
|
-
export interface ConsoleCallbacks {
|
|
103
|
-
/**
|
|
104
|
-
* Callback invoked for each console operation.
|
|
105
|
-
* Receives a structured entry with all data needed to render the output.
|
|
106
|
-
*/
|
|
107
|
-
onEntry?: (entry: ConsoleEntry) => void;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Fetch callback type.
|
|
111
|
-
*/
|
|
112
|
-
export type FetchCallback = (request: Request) => Response | Promise<Response>;
|
|
113
|
-
/**
|
|
114
|
-
* File system callback handlers.
|
|
115
|
-
*/
|
|
116
|
-
export interface FileSystemCallbacks {
|
|
117
|
-
readFile?: (path: string) => Promise<ArrayBuffer>;
|
|
118
|
-
writeFile?: (path: string, data: ArrayBuffer) => Promise<void>;
|
|
119
|
-
unlink?: (path: string) => Promise<void>;
|
|
120
|
-
readdir?: (path: string) => Promise<string[]>;
|
|
121
|
-
mkdir?: (path: string, options?: {
|
|
122
|
-
recursive?: boolean;
|
|
123
|
-
}) => Promise<void>;
|
|
124
|
-
rmdir?: (path: string) => Promise<void>;
|
|
125
|
-
stat?: (path: string) => Promise<{
|
|
126
|
-
isFile: boolean;
|
|
127
|
-
isDirectory: boolean;
|
|
128
|
-
size: number;
|
|
129
|
-
}>;
|
|
130
|
-
rename?: (from: string, to: string) => Promise<void>;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Module loader callback type.
|
|
134
|
-
* Called when the isolate imports a module dynamically.
|
|
135
|
-
* Returns the JavaScript source code for the module.
|
|
136
|
-
*/
|
|
137
|
-
export type ModuleLoaderCallback = (moduleName: string) => string | Promise<string>;
|
|
138
|
-
export type { CustomFunctionType };
|
|
139
|
-
/**
|
|
140
|
-
* A custom function that can be called from within the isolate.
|
|
141
|
-
*/
|
|
142
|
-
export type CustomFunction = (...args: unknown[]) => unknown | Promise<unknown>;
|
|
143
|
-
/**
|
|
144
|
-
* An async generator function that can be consumed in the isolate via for await...of.
|
|
145
|
-
*/
|
|
146
|
-
export type CustomAsyncGeneratorFunction = (...args: unknown[]) => AsyncGenerator<unknown, unknown, unknown>;
|
|
147
|
-
/**
|
|
148
|
-
* Custom function definition with metadata.
|
|
149
|
-
*/
|
|
150
|
-
export interface CustomFunctionDefinition {
|
|
151
|
-
/** The function implementation */
|
|
152
|
-
fn: CustomFunction | CustomAsyncGeneratorFunction;
|
|
153
|
-
/** Function type: 'sync', 'async', or 'asyncIterator' */
|
|
154
|
-
type: CustomFunctionType;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Custom functions to register in the runtime.
|
|
158
|
-
*/
|
|
159
|
-
export type CustomFunctions = Record<string, CustomFunctionDefinition>;
|
|
160
|
-
/**
|
|
161
|
-
* Options for eval() method.
|
|
162
|
-
*/
|
|
163
|
-
export interface EvalOptions {
|
|
164
|
-
/** Filename for stack traces */
|
|
165
|
-
filename?: string;
|
|
166
|
-
/** Maximum execution time in milliseconds. If exceeded, throws a timeout error. */
|
|
167
|
-
maxExecutionMs?: number;
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Always uses module mode now. This option is ignored.
|
|
170
|
-
*/
|
|
171
|
-
module?: boolean;
|
|
172
62
|
}
|
|
173
63
|
/**
|
|
174
64
|
* WebSocket upgrade request info.
|
|
@@ -294,10 +184,3 @@ export interface RemotePlaywrightHandle {
|
|
|
294
184
|
/** Clear collected data */
|
|
295
185
|
clearCollectedData(): Promise<void>;
|
|
296
186
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Options for dispatching a request.
|
|
299
|
-
*/
|
|
300
|
-
export interface DispatchOptions {
|
|
301
|
-
/** Request timeout in ms */
|
|
302
|
-
timeout?: number;
|
|
303
|
-
}
|