Guide

How to test code written by GitHub Copilot

GitHub Copilot can write code and tests in chat, in the cloud agent, and as review comments on a pull request. That is helpful, and it is still the author grading its own work if you stop at a green test run the agent just produced. This page is the Copilot setup: put the real test commands in repository instructions, review the diff separately, then confirm the tests would fail if the new code were wrong.

The same method works in Claude Code, Cursor and Codex. Instruction file names and MCP setup below follow GitHub and VS Code docs as of 23 November 2026.

Put test commands in Copilot instructions

In VS Code, repository-wide Copilot instructions live in .github/copilot-instructions.md. Path-specific rules go in .github/instructions/*.instructions.md with an applyTo front matter glob. Agent instructions can also use AGENTS.md. The Copilot cloud agent can read AGENTS.md, CLAUDE.md or GEMINI.md. Copilot code review uses the repository-wide instructions file.

VS Code is explicit that instructions guide the model. They do not guarantee compliance, and they do not replace tests, code review or security controls. They also do not apply to inline suggestions as you type. Write the exact test commands anyway, so chat and the cloud agent have a real way to check their work.

## How to check work in this repo
- Typecheck: pnpm tsc --noEmit
- Unit tests: pnpm vitest run
- One file: pnpm vitest run path/to/file.test.ts
- Integration tests need DATABASE_URL (see .env.example)
- Never edit snapshot files to make a test pass. Ask first.

Ask for a failing test and a fresh review

For a bug fix, ask Copilot Chat or the cloud agent to write a failing test, show the failure, then fix the code and show the same test passing, with commands and output. Then review the diff in a new chat, or with Copilot code review, or with a human. The session that wrote the patch should not be the only reader of it.

Copilot code review can catch issues in the diff. Like other review bots, it comments on the change. It does not execute your tests or prove they would fail if the new behavior were wrong.

Add OrangePro as an MCP server in VS Code

GitHub Copilot in VS Code (1.99 or later) can use MCP servers. You can add a server in Chat customizations, in a repository .vscode/mcp.json so the team shares it, or in your user settings.json. Local MCP servers run on your machine, so review the command before you trust it. For Copilot Business or Enterprise, an organization policy, "MCP servers in Copilot," is disabled by default and must be enabled for those seats. Copilot Free, Pro, Pro+ and Max are not governed by that policy.

{
  "servers": {
    "orangepro-local": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@orangepro/mcp-server@latest", "mcp"]
    }
  }
}

You can also print a generic MCP snippet with npx -y @orangepro/mcp-server@latest agent --client generic. OrangePro ranks functions with weak test evidence and can show whether a test catches a break. Mapping, ranking and proof stay on your machine. That is the step review comments and a green Copilot test run cannot do on their own.

Frequently asked questions

Start with .github/copilot-instructions.md for the whole repository. Use .github/instructions/*.instructions.md for path-specific rules, and AGENTS.md for agent instructions. The cloud agent can also read CLAUDE.md or GEMINI.md. Instructions guide the model; they do not replace tests.

No. Copilot code review comments on the diff, using repository-wide instructions if you have them. It does not run your tests or prove they would fail if the new code were wrong.

Add a local MCP server in .vscode/mcp.json or in user settings, or through Chat customizations. For Copilot Business and Enterprise, the organization has to enable the MCP servers in Copilot policy. Then ask Copilot to use the OrangePro tools on the current change.

No for mapping, ranking and proof. Drafting tests with real assertions uses a model provider you choose, with your own key, called directly from your machine.

Try it on your code

Add the local MCP server in VS Code and ask Copilot for the top unprotected function. Local runs do not upload your source.

$npx -y @orangepro/mcp-server@latest agent --client generic

Built for after merge, before release. It is not a pull request or release gate. Local scans do not upload source.