tableau-mcp / rules
Cursor rule347 starsChanged 6 months agoApache-2.0View on GitHub
Testing standards — Vitest framework, test organization, mocking patterns
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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/auth.mdcCursor rule
- .cursor/rules/tableau-mcp.mdcCursor rule
- .cursor/rules/tools.mdcCursor rule
- create-pr-from-commitsSkill
The file
We split this testing.mdc into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 48
Test files: *.test.ts (co-located with source for unit tests)
- Distinctive: line 49
Test names: describe the behavior being verified
- Distinctive: line 53
Use real code whenever possible — mocks only when unavoidable
- Distinctive: line 55
When mocking Tableau API responses, use realistic data shapes
- Distinctive: line 56
Never mock the code under test — mock its dependencies
- Very specific: line 77
All unit tests pass: npm test
- Very specific: line 78
No TypeScript errors: npx tsc --noEmit
- Very specific: line 79
No lint errors: npx eslint src/
≈ “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 — Vitest framework, test organization, mocking patterns
globs:
- "**/*.test.ts"
- "tests/**/*.ts"
- "vitest.config*.ts"
---
# Testing Standards
## Framework: Vitest
This project uses Vitest. NOT jest, NOT mocha.
## Test Configs
| Config | Command | Directory | Purpose |
|--------|---------|-----------|---------|
| `vitest.config.ts` | `npm test` | `src/` | Unit tests |
| `vitest.config.e2e.ts` | `npm run test:e2e` | `tests/e2e/` | End-to-end (stdio client) |
| `vitest.config.eval.ts` | `npm run test:eval` | `tests/eval/` | AI agent evaluation |
| `vitest.config.oauth.embedded.ts` | `npm run test:oauth:embedded` | `tests/oauth/embedded-authz/` | OAuth flows |
Coverage: `npm run coverage` (v8 provider, cobertura reporter)
## Unit Test Setup
`src/testSetup.ts` automatically:
- Mocks `Server` class
- Mocks `RestApi` class
- Stubs environment variables
Unit tests live alongside source: `src/tools/myTool/myTool.test.ts`
## E2E Test Pattern
Tests use `StdioClientTransport` spawning `node build/index.js`:
```typescript
import { callTool, getClient, listTools } from './client';
describe('my-tool', () => {
it('returns expected data', async () => {
const result = await callTool('my-tool', { param: 'value' });
expect(result).toBeDefined();
});
});
```
Helpers in `tests/e2e/client.ts`: `callTool()`, `listTools()`, `getClient()`
## Test Naming
- Test files: `*.test.ts` (co-located with source for unit tests)
- Test names: describe the behavior being verified
- One behavior per test — if "and" appears in the name, split it
## Mocking Rules
- Use real code whenever possible — mocks only when unavoidable
- `src/testSetup.ts` provides standard mocks for Server and RestApi
- When mocking Tableau API responses, use realistic data shapes
- Never mock the code under test — mock its dependencies
## Running Tests
```bash
# Unit tests (fast, run these constantly)
npm test
# Single file
npx vitest run src/tools/myTool/myTool.test.ts
# Watch mode
npx vitest src/tools/myTool/myTool.test.ts
# E2E (requires build first)
npm run build && npm run test:e2e
# Coverage report
npm run coverage
```
## Before Marking Work Complete
- All unit tests pass: `npm test`
- No TypeScript errors: `npx tsc --noEmit`
- No lint errors: `npx eslint src/`
- New code has test coverage
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.

