typescript-testing SKILL.md skillA
typescript-testing from shinpr/ai-coding-project-boilerplate is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
mdr add shinpr/ai-coding-project-boilerplate/typescript-testing@git:20261014.f06813cPins git:20261014.f06813c in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 17 of 17 checks passed
- Kind
- SKILL.md skill
- Repository
- shinpr/ai-coding-project-boilerplate
- Path
.claude/skills-zh-CN/typescript-testing/SKILL.md- Versions recorded
- 4
- Latest version
- git:20261014.f06813c, committed Oct 14, 2026
- First version recorded
- Aug 31, 2026
- Size
- 7,901 bytes
- Repository stars
- 234
- License
- MIT
应用具备仓库感知能力的 TypeScript 测试设计、行为依据、隔离性与 mock 边界标准。用于编写或评审单元测试时。.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# TypeScript 测试规则
## 前置条件检测
在选择测试框架或命令之前,先检查 `package.json`、锁文件、测试配置以及现有测试的导入方式。仅当配置了 Vitest 时才应用 Vitest 专属规则;否则使用仓库已配置的 TypeScript 测试工具,同时保留以下关于行为、隔离性与依据的规则。如果无法确认可运行的测试工具,请报告已检查的路径以及缺失的命令或配置。
## 测试框架
- **Vitest**:当仓库配置或现有测试选用了 Vitest 时使用
- 测试导入:`import { describe, it, expect, beforeEach, vi } from 'vitest'`
- Mock 创建:使用 `vi.mock()`
## 基本测试策略
### 质量要求
- **回归保护**:将测试集中在关键路径、业务逻辑以及一旦回归就会造成实质影响的行为上。当某个未受保护的行为存在实质性回归风险时,添加测试
- **独立性**:每个测试都能独立运行,不依赖其他测试
- **可复现性**:控制时间、随机性、环境变量与外部 I/O,使相同输入产生相同的可观测结果
- **可读性**:每个测试只描述一种行为,将准备/执行/断言分离,并将测试数据限制为该行为实际用到的值
### 测试类型与范围
1. **单元测试**
- 验证单个函数或类的行为
- Mock 所有外部依赖
2. **集成测试**
- 验证多个组件之间的协作
- 对属于被测行为一部分的进程内真实组件使用真实实现;关于外部 I/O 的处理见“Mock 范围决策”
- 验证实现主要验收标准或跨越进程内组件边界的流程
3. **跨功能验证**
- 当新功能触及共享的集成点时,若现有功能失效会破坏主要用户旅程或公开契约,或降低次要可观测行为,则现有功能的连续性成为一项证明义务。在能够暴露其失效的成本最低的边界上加以证明
- 验证模式:现有功能运行 -> 启用新功能 -> 验证现有功能的连续性
- 成功标准:保留来源验收标准所指定的响应字段与可观测行为;仅当需求或项目配置定义了处理时间阈值的取值与测量方法时,才应用该阈值
- 设计为可在 CI/CD 流水线中自动执行
## 测试实现规范
### 目录结构与命名
- 测试位于被测模块旁的 `__tests__/` 目录中
- 测试文件:`{target-file-name}.test.ts`
- 集成测试文件:`{target-file-name}.int.test.ts`
- 测试套件:描述目标功能或场景的名称
- 测试用例:描述预期行为的名称
### 测试代码质量规则
…Read the whole file at its exact version.
How to install
mdr add shinpr/ai-coding-project-boilerplate/typescript-testing@sha256:b590460b90ef6e4bThe line at the top of this page pins the label git:20261014.f06813c, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_53m55fkde2gay47e)
3 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 4 versions of this file, between Aug 31, 2026 and Oct 14, 2026, about one every 15 days.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| git:20261014.f06813c latest | 2026-10-14 | f06813c | 7,901 B | A | view · diff |
| git:20260923.558b381 | 2026-09-23 | 558b381 | 7,853 B | A | view · diff |
| git:20260923.03f66be | 2026-09-23 | 03f66be | 7,842 B | A | view · diff |
| git:20260831.b183037 | 2026-08-31 | b183037 | 7,875 B | A | view |
Audit of the latest version
- pass: Frontmatter block present
- pass: Frontmatter declares a name
- pass: Frontmatter declares a description
- pass: Size between 200 bytes and 200 KB (7901 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
shinpr/ai-coding-project-boilerplate · 234 stars · license MIT · pushed 2026-10-14 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_53m55fkde2gay47e GET https://markdownregistry.com/api/v1/resolve?ref=shinpr/ai-coding-project-boilerplate/typescript-testing GET https://markdownregistry.com/api/v1/blob/b590460b90ef6e4bfc4d6c1a4f88f1bb378797697e884e758e2d5d3047dfe74a
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.
More from shinpr/ai-coding-project-boilerplate
Every file in shinpr/ai-coding-project-boilerplate