@efffrida/vitest-pool

中文文档
0.0.60发布于 2026/11/13GPL-3.0-onlyES Module构建来源已验证近 30 天下载 2220

Vitest pool that runs tests inside a Frida agent

原始使用文档

@efffrida/vitest-pool

A vitest pool that runs test files inside a frida agent, so tests execute in the target process instead of in node.

Example usage

import { createFridaPool } from "@efffrida/vitest-pool";
import { defineConfig } from "vitest/config";

export default defineConfig({
    test: {
        include: ["test/**/*.test.ts"],
        pool: createFridaPool({
            device: { connection: "local" },
            attach: { spawn: ["/usr/bin/sleep", "infinity"] },
        }),
    },
});

Each worker writes an agent into a temporary .vitest-frida-pool-* directory under the project root, compiles it with frida's compiler, and loads it into the attached session. Worker initialization is serialized, so only one agent is compiled and attached at a time.

Vitest patch

The agent imports vitest's test runner (startTests and collectTests from vitest/internal/browser), which lives in vitest/dist/chunks/run.BPv-BBRv.js. That chunk contains the regex /\$([$\p{ID_Continue}.]+)/gu used to interpolate test.each titles, and frida's JS runtime can't parse unicode property escapes (see frida/frida-gum#1195), so loading the agent fails with a syntax error.

patches/[email protected] replaces it with /\$([$\w.]+)/g. The only behavior change is that $name interpolation in test.each titles matches ascii identifiers only.

The patch targets a content hashed chunk name, so it has to be regenerated whenever vitest is bumped, even if the regex itself is unchanged. Run pnpm patch vitest@<version>, apply the same change to whichever run.*.js chunk now contains the regex, then pnpm patch-commit and update patchedDependencies in pnpm-workspace.yaml. Projects outside this repository that use the pool need to apply the same patch.

版本与发布记录

@efffrida/vitest-pool 共发布 59 个版本,首次发布于 2025/11/18;过去 12 个月发布了 59 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.60latest2026/11/131 天前
0.0.592026/11/112 天前
0.0.582026/11/095 天前
0.0.572026/11/068 天前
0.0.562026/11/0311 天前
0.0.552026/11/0211 天前

关于 @efffrida/vitest-pool 的常见问题

@efffrida/vitest-pool 是什么?

Vitest pool that runs tests inside a Frida agent

如何安装 @efffrida/vitest-pool?

在项目目录运行 npm install @efffrida/vitest-pool,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vite(8.3.8)、birpc(4.2.0)、effect(4.1.4)、vitest(5.1.0)、flatted(3.4.4)、@vitest/utils(5.1.0)、@efffrida/polyfills(0.0.25)、@effect/platform-node-shared(4.1.4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@efffrida/vitest-pool 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/efffrida__vitest-pool 是否存在。

@efffrida/vitest-pool 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@efffrida/vitest-pool 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@efffrida/vitest-pool 可以商用吗?

@efffrida/vitest-pool 使用 GPL-3.0-only 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以 GPL-3.0 兼容许可开源,并附带专利与反锁定条款。仅内部使用不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@efffrida/vitest-pool 的下载量有多少?

根据 npm 官方下载统计,@efffrida/vitest-pool 在 2026/10/13 – 2026/11/11 这 30 天内被下载 2,220 次,日均约 74 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@efffrida/vitest-pool 还在维护吗?

最新版本 0.0.60 发布于 2026/11/13(1 天前);至今共发布 59 个版本,其中过去 12 个月发布了 59 个;首次发布于 2025/11/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。