mcp-devtools / rules
Cursor rule13 starsChanged 21 months agoMITArchived repositoryView on GitHub
Testing Standards
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository9 other files it gives its agents.
- .cursor/rules/ai-assisted-development.mdcCursor rule
- .cursor/rules/core-libraries-usage.mdcCursor rule
- .cursor/rules/mcp-server-implementation.mdcCursor rule
- .cursor/rules/mcp-tool-implementation.mdcCursor rule
- .cursor/rules/new-package-creation.mdcCursor rule
- .cursor/rules/package-documentation.mdcCursor rule
- .cursor/rules/repository-structure.mdcCursor rule
- .cursor/rules/rules-for-cursor.mdcCursor rule
- .cursor/rules/typescript-style.mdcCursor rule
The file
Show its rules and text
We split this testing-standards.mdc into the rules it gives an agent
15 rules. About 0 are common, 14 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Follow these standards when writing tests for MCP DevTools packages:
- Very specific: line 69
Use descriptive describe and it blocks
- Distinctive: line 71
Follow the Arrange-Act-Assert pattern
- Distinctive: line 72
Keep tests focused on a single functionality
- Distinctive: line 77
Use jest.mock() for external modules
- Distinctive: line 78
Create dedicated mock factories for complex objects
- Distinctive: line 84
Test happy paths and error paths
- Distinctive: line 86
Test asynchronous behavior correctly
- Distinctive: line 90
Use realistic test data
- Distinctive: line 91
Create helper functions for test data generation
- Distinctive: line 92
Avoid test data duplication
- Distinctive: line 93
Keep test data close to tests that use it
- Distinctive: line 97
Test return values, side effects, and exceptions
- Distinctive: line 98
Use appropriate matchers (toEqual, toBeCalledWith, etc.)
- Distinctive: line 99
Write custom matchers for complex assertions
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Testing Standards
globs: packages/*/src/**/*.test.ts
alwaysApply: true
---
# Testing Standards
Follow these standards when writing tests for MCP DevTools packages:
@file packages/_/src/\*\*/_.test.ts
@file .cursor/rules/typescript-style.mdc
## Test Structure
```typescript
import {
describe,
it,
expect,
beforeEach,
afterEach,
jest,
} from "@jest/globals";
import { featureUnderTest } from "../path/to/feature";
describe("Feature Name", () => {
// Setup mocks and test fixtures
beforeEach(() => {
// Setup code
});
afterEach(() => {
// Cleanup code
jest.resetAllMocks();
});
describe("Specific Functionality", () => {
it("should behave as expected in normal conditions", async () => {
// Arrange
const input = {
/* test data */
};
// Act
const result = await featureUnderTest(input);
// Assert
expect(result).toEqual(/* expected output */);
});
it("should handle error cases appropriately", async () => {
// Arrange
const invalidInput = {
/* invalid test data */
};
// Act & Assert
await expect(featureUnderTest(invalidInput)).rejects.toThrow();
});
});
});
```
## Testing Guidelines
1. **Test Organization**
- Use descriptive `describe` and `it` blocks
- Group related tests together
- Follow the Arrange-Act-Assert pattern
- Keep tests focused on a single functionality
2. **Mocking**
- Mock external dependencies
- Use jest.mock() for external modules
- Create dedicated mock factories for complex objects
- Reset mocks between tests
3. **Coverage**
- Aim for >80% code coverage
- Test happy paths and error paths
- Include edge cases and boundary conditions
- Test asynchronous behavior correctly
4. **Test Data**
- Use realistic test data
- Create helper functions for test data generation
- Avoid test data duplication
- Keep test data close to tests that use it
5. **Assertions**
- Make assertions specific and meaningful
- Test return values, side effects, and exceptions
- Use appropriate matchers (toEqual, toBeCalledWith, etc.)
- Write custom matchers for complex assertions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

