Back to MCP directory
publicPublicdnsLocal runtime

test-gru

Test Gru是一个自动化单元测试工具,支持Node.js/TypeScript项目,通过GitHub集成自动为代码添加并运行单元测试,简化测试流程。

article

README

🚀 忘掉单元测试

忘掉单元测试那些事儿吧。

🚀 快速开始

准备步骤

  1. 访问 Gru.ai
  2. 选择仓库。
  3. 启用自动触发设置。

自动触发

  • 当提交 PR 时,会自动添加单元测试。
  • Gru 会添加单元测试代码,若测试代码能正常运行,它会向原 PR 提交一个附带测试代码的 PR。

手动触发

  1. 访问 Gru.ai
  2. 选择「手动触发」。
  3. 选择所需文件并执行触发操作。

📦 安装指南

这里虽未明确提及安装相关命令,但从内容推测可将配置文件部分视为安装配置环节。

配置文件 grutest.yaml

# 忽略的模拟库配置
mockIgnore: ["lodash", "ajv"]

测试代码的放置策略

集中式

说明

集中式是将测试代码放置在专用目录中。

示例

目录结构:

.
├── package.json
├── src
│   └── sum.ts
└── test
    └── sum.test.ts

grutest.yaml 配置:

testPlacementStrategies:
  - type: centralized
     testDir: test
     testFilePattern: "{{sourceFileName}}.test.ts"

同位置式

说明

同位置式是将测试代码与源代码放置在同一目录中。

示例

目录结构:

.
├── package.json
└── src
    ├── sum.test.ts
    └── sum.ts

grutest.yaml 配置:

testPlacementStrategies:
    - type: co-located
      testFilePattern: "{{sourceFileName}}.test.ts"

🔧 技术细节

自动触发

PR 自动触发

  • 提交 PR 时,Gru 会自动添加单元测试。
  • 若测试代码正常运行,会向原 PR 提交附带测试代码的 PR。

图片

手动触发

  1. 访问 Gru.ai
  2. 选择仓库并点击「手动触发」。

图片

触发方式

  • 提交 PR 时会自动添加单元测试。
  • 也可以在任意时间手动触发。

图片

图片

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client