@efffrida/vitest-pool 0.0.2 → 0.0.3
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/package.json +22 -22
- package/src/index.ts +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efffrida/vitest-pool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "effect frida vitest-pool",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"frida.re",
|
|
@@ -31,34 +31,34 @@
|
|
|
31
31
|
"dist/**/*.d.ts.map"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@vitest/runner": "4.0.
|
|
35
|
-
"@vitest/utils": "4.0.
|
|
36
|
-
"birpc": "
|
|
37
|
-
"esbuild": "0.27.
|
|
34
|
+
"@vitest/runner": "4.0.16",
|
|
35
|
+
"@vitest/utils": "4.0.16",
|
|
36
|
+
"birpc": "4.0.0",
|
|
37
|
+
"esbuild": "0.27.2",
|
|
38
38
|
"flatted": "3.3.3",
|
|
39
|
-
"@efffrida/
|
|
40
|
-
"@efffrida/
|
|
39
|
+
"@efffrida/frida-tools": "0.0.17",
|
|
40
|
+
"@efffrida/polyfills": "0.0.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@effect/cluster": "0.
|
|
44
|
-
"@effect/experimental": "0.
|
|
45
|
-
"@effect/platform": "0.
|
|
46
|
-
"@effect/platform-node": "0.
|
|
47
|
-
"@effect/rpc": "0.
|
|
48
|
-
"@effect/sql": "0.
|
|
49
|
-
"@effect/workflow": "0.
|
|
43
|
+
"@effect/cluster": "0.56.0",
|
|
44
|
+
"@effect/experimental": "0.58.0",
|
|
45
|
+
"@effect/platform": "0.94.0",
|
|
46
|
+
"@effect/platform-node": "0.104.0",
|
|
47
|
+
"@effect/rpc": "0.73.0",
|
|
48
|
+
"@effect/sql": "0.49.0",
|
|
49
|
+
"@effect/workflow": "0.16.0",
|
|
50
50
|
"@types/frida-gum": "19.0.1",
|
|
51
|
-
"@types/node": "
|
|
52
|
-
"effect": "3.19.
|
|
51
|
+
"@types/node": "25.0.3",
|
|
52
|
+
"effect": "3.19.13",
|
|
53
53
|
"frida": "17.5.1",
|
|
54
|
-
"vitest": "4.0.
|
|
54
|
+
"vitest": "4.0.16"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@effect/platform": "0.
|
|
58
|
-
"@vitest/runner": "4.0.
|
|
59
|
-
"@vitest/utils": "4.0.
|
|
60
|
-
"effect": "3.19.
|
|
61
|
-
"vitest": "4.0.
|
|
57
|
+
"@effect/platform": "0.94.0",
|
|
58
|
+
"@vitest/runner": "4.0.16",
|
|
59
|
+
"@vitest/utils": "4.0.16",
|
|
60
|
+
"effect": "3.19.13",
|
|
61
|
+
"vitest": "4.0.16"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type * as PlatformError from "@effect/platform/Error";
|
|
|
2
2
|
import type * as FridaDeviceAcquisitionError from "@efffrida/frida-tools/FridaDeviceAcquisitionError";
|
|
3
3
|
import type * as FridaSessionError from "@efffrida/frida-tools/FridaSessionError";
|
|
4
4
|
import type * as Option from "effect/Option";
|
|
5
|
+
import type * as ParseResult from "effect/ParseResult";
|
|
5
6
|
import type * as Runtime from "effect/Runtime";
|
|
6
7
|
import type * as VitestNode from "vitest/node";
|
|
7
8
|
|
|
@@ -108,6 +109,17 @@ export class FridaPoolWorker implements VitestNode.PoolWorker {
|
|
|
108
109
|
| FridaSessionError.FridaSessionError
|
|
109
110
|
>
|
|
110
111
|
| undefined;
|
|
112
|
+
private sends: Array<
|
|
113
|
+
Promise<
|
|
114
|
+
Exit.Exit<
|
|
115
|
+
void,
|
|
116
|
+
| FridaDeviceAcquisitionError.FridaDeviceAcquisitionError
|
|
117
|
+
| PlatformError.PlatformError
|
|
118
|
+
| FridaSessionError.FridaSessionError
|
|
119
|
+
| ParseResult.ParseError
|
|
120
|
+
>
|
|
121
|
+
>
|
|
122
|
+
> = [];
|
|
111
123
|
|
|
112
124
|
constructor(poolOptions: VitestNode.PoolOptions, customOptions: Schema.Schema.Type<ConfigSchema>) {
|
|
113
125
|
this.poolOptions = poolOptions;
|
|
@@ -200,16 +212,21 @@ export class FridaPoolWorker implements VitestNode.PoolWorker {
|
|
|
200
212
|
}
|
|
201
213
|
|
|
202
214
|
async stop(): Promise<void> {
|
|
215
|
+
await Promise.allSettled(this.sends);
|
|
203
216
|
await this.managedRuntime!.dispose();
|
|
204
217
|
await Effect.runPromise(Scope.close(this.modifiedAgentScope, Exit.void));
|
|
205
218
|
}
|
|
206
219
|
|
|
207
220
|
async send(message: VitestNode.WorkerRequest): Promise<void> {
|
|
208
|
-
const
|
|
221
|
+
const sendPromise = this.managedRuntime!.runPromiseExit(
|
|
209
222
|
Effect.flatMap(FridaScript.FridaScript, (fridaScript) =>
|
|
210
223
|
fridaScript.callExport("onMessage", Schema.Void)(message)
|
|
211
224
|
)
|
|
212
225
|
);
|
|
226
|
+
|
|
227
|
+
this.sends.push(sendPromise);
|
|
228
|
+
const exit = await sendPromise;
|
|
229
|
+
this.sends = this.sends.filter((p) => p !== sendPromise);
|
|
213
230
|
if (Exit.isSuccess(exit)) return;
|
|
214
231
|
const prettyError = Cause.prettyErrors(exit.cause);
|
|
215
232
|
throw prettyError[0];
|
|
@@ -254,7 +271,7 @@ export class FridaPoolWorker implements VitestNode.PoolWorker {
|
|
|
254
271
|
case "exit":
|
|
255
272
|
cancelable = this.managedRuntime!.runCallback(
|
|
256
273
|
Effect.flatMap(FridaScript.FridaScript, (fridaScript) => Deferred.await(fridaScript.destroyed)),
|
|
257
|
-
{ onExit: () => callback(
|
|
274
|
+
{ onExit: () => callback(void 0) }
|
|
258
275
|
);
|
|
259
276
|
break;
|
|
260
277
|
|