Skip to content

docs: complete Testing Guidelines section in AGENTS.md#566

Closed
Copilot wants to merge 2 commits into
merge-asyncfrom
copilot/vscode1758008510235
Closed

docs: complete Testing Guidelines section in AGENTS.md#566
Copilot wants to merge 2 commits into
merge-asyncfrom
copilot/vscode1758008510235

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 16, 2025

This PR completes the TODO in the AGENTS.md file by filling in the comprehensive Testing Guidelines section that was previously empty.

What's Added

The new Testing Guidelines section provides complete documentation for contributors working on the rstest project, covering:

Test Organization

  • Clear structure for unit tests in packages/core/tests mirroring packages/core/src
  • Organization of e2e tests in e2e/ with feature-based structure
  • Consistent .test.ts/.test.tsx file naming conventions

Unit Testing Best Practices

  • Guidelines for testing individual functions, classes, and modules in isolation
  • Proper use of describe blocks, beforeEach/afterEach hooks
  • Mocking patterns using rs.fn() and rs.mock()
  • Complete example showing proper imports and test structure:
import { beforeEach, describe, expect, it, rs } from '@rstest/core';
import { functionToTest } from '../../src/utils/helper';

describe('functionToTest', () => {
  beforeEach(() => {
    // Setup before each test
  });

  it('should handle normal case correctly', () => {
    expect(functionToTest('input')).toBe('expected');
  });
});

Integration/E2E Testing

  • Guidelines for validating complete workflows and feature interactions
  • Organization by feature areas (cli/, dom/, test-api/, lifecycle/)
  • Testing CLI commands and configurations with realistic scenarios

Additional Guidelines

  • Test Data & Fixtures: Co-location, meaningful test data, test.extend usage, inline snapshots
  • Async Testing: Consistent async/await patterns, error case testing, timeout handling
  • Testing Commands: Complete reference for pnpm test, pnpm e2e, pnpm typecheck, pnpm lint
  • Quality Standards: Meaningful coverage, deterministic tests, clear purposes, performance considerations

Implementation Approach

The guidelines were created by analyzing the existing codebase patterns in both unit tests (packages/core/tests) and e2e tests (e2e/), ensuring the documentation reflects actual practices used throughout the project. All examples are based on real patterns found in the repository.

Validation

  • ✅ All linting and formatting checks pass (pnpm lint, pnpm format)
  • ✅ Spelling and heading case checks pass
  • ✅ Unit and e2e tests continue to pass
  • ✅ TypeScript type checking passes

This documentation will help new contributors understand the testing approach and maintain consistency across the project.

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ fi3ework
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@fi3ework fi3ework closed this Sep 16, 2025
Copilot AI changed the title [WIP] Work on TODO: --> (from AGENTS.md) docs: complete Testing Guidelines section in AGENTS.md Sep 16, 2025
Copilot AI requested a review from fi3ework September 16, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants