用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill test命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | test |
| description | Run and write Vitest tests, mock Jaypie with testkit, CI matrix Use when this capability is needed. |
| metadata | {"author":"finlaysonstudio"} |
How to run and write tests in this monorepo.
npm test # Run ALL tests across all packages (vitest run)
npm test -w packages/<name> # Run tests for a specific package
npm test -w workspaces/<name> # Run tests for a specific workspace
Never run bare vitest -- it defaults to watch mode and won't terminate. Always use npm test or vitest run.
npm run test:jaypie # packages/jaypie
npm run test:llm # packages/llm
npm run test:testkit # packages/testkit
npm run test:express # packages/express
npm run test:errors # packages/errors
# ... etc (test:<package-name> for each package)
Require API keys. Run locally or in CI when packages/llm/** changes:
npm run test:llm:client # Basic client tests
npm run test:llm:all # All LLM tests (client, document, image, joke, reasoning, structured)
npm run test:llm:joke # Individual test suite
vitest.workspace.ts at root discovers packages/*/vitest.config.{ts,js}vitest.config.ts and optional vitest.setup.tsTests live alongside source or in __tests__/ directories:
src/
├── services/
│ └── user.ts
└── __tests__/
└── user.spec.ts
# Or co-located:
src/
└── services/
├── user.ts
└── user.spec.ts
import { describe, expect, it, vi, beforeEach } from "vitest";
describe("MyFunction", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("does the expected thing", async () => {
// Arrange
const input = { key: "value" };
// Act
const result = await myFunction(input);
// Assert
expect(result).toBeDefined();
});
});
Most packages mock jaypie in their vitest.setup.ts:
// vitest.setup.ts
import { vi } from "vitest";
vi.mock("jaypie", async () => {
const { mockJaypie } = await import("@jaypie/testkit");
return mockJaypie(vi);
});
This mocks log, getSecret, sendMessage, and other Jaypie exports as vi.fn().
import { log, getSecret } from "jaypie";
it("logs the operation", async () => {
await myFunction();
expect(log.info).toHaveBeenCalledWith("message");
});
it("reads a secret", async () => {
vi.mocked(getSecret).mockResolvedValue("mock-value");
await myFunction();
expect(getSecret).toHaveBeenCalledWith("secret-name");
});
// @jaypie/logger
vi.mock("@jaypie/logger", async () => {
const { mockLogger } = await import("@jaypie/testkit");
return mockLogger(vi);
});
// @jaypie/aws
vi.mock("@jaypie/aws", async () => {
const { mockAws } = await import("@jaypie/testkit");
return mockAws(vi);
});
import { NotFoundError } from "jaypie";
it("throws NotFoundError when missing", async () => {
await expect(myFunction("bad-id")).rejects.toThrow(NotFoundError);
});
import { matchers } from "@jaypie/testkit";
expect.extend(matchers);
it("throws a Jaypie error", async () => {
await expect(myFunction()).rejects.toBeJaypieError();
});
// vitest.config.ts
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
coverage: {
reporter: ["text", "json", "html"],
},
globals: true,
setupFiles: ["./vitest.setup.ts"],
},
});
Tests often depend on built artifacts. In CI, npm run build runs before npm test. Locally, if tests fail on import errors, rebuild first:
npm run build && npm test -w packages/<name>
When adding a new export to any package, update packages/testkit to mock it -- otherwise tests across the monorepo will fail.
Tests run on Node.js 22, 24, 25 in npm-check.yml and on 22, 24 in stack deployment workflows. The continue-on-error typecheck job won't block merges but lint and test must pass.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类