Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Repository Guidelines

This repository contains runnable examples for the Reassure performance testing library.

Use Yarn, not npm. The root uses `yarn@4.6.0`; individual examples currently use `yarn@4.9.2`.

Active code lives under `examples/`. Run installs, tests, typechecks, builds, and app commands from the specific example directory you changed because scripts and dependency versions are isolated per app.

Non-standard validation to remember: `yarn perf-test` runs Reassure performance tests in examples that define it.

React Native examples use `@testing-library/react-native`. Its APIs and testing conventions can differ from your training data.
Before writing or changing RNTL tests, read the relevant guide in
`node_modules/@testing-library/react-native/docs/`, starting with
`node_modules/@testing-library/react-native/docs/guides/llm-guidelines.md`.
Prefer those package docs over stale assumptions, and follow deprecation notices.

See the focused guides before making task-specific changes:

- [Project Structure](docs/agents/project-structure.md)
- [Commands](docs/agents/commands.md)
- [Coding Style](docs/agents/coding-style.md)
- [Testing](docs/agents/testing.md)
- [Git Workflow](docs/agents/git-workflow.md)
- [Instruction Audit](docs/agents/instruction-audit.md)
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
18 changes: 18 additions & 0 deletions docs/agents/coding-style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Coding Style

Use TypeScript and React function components for new example code.

Follow the root formatting configuration:

- two-space indentation
- LF line endings
- UTF-8
- final newline
- trimmed trailing whitespace
- single quotes
- ES5 trailing commas
- 120-column Prettier width

Name component files with PascalCase when they export a component, such as `TestList.tsx`.

Keep example code idiomatic to its framework. Do not introduce shared abstractions across examples unless the task explicitly requires cross-example behavior.
22 changes: 22 additions & 0 deletions docs/agents/commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Commands

Install dependencies from the target example directory:

```sh
cd examples/web-vite
yarn install
```

Common scripts vary by example:

- `yarn test`: run Jest tests.
- `yarn perf-test`: run Reassure performance tests where configured.
- `yarn typecheck`: run TypeScript checks where configured.
- `yarn lint`: run ESLint in examples that define it.
- `yarn dev`: start Vite or Next.js development servers.
- `yarn preview`: preview the Vite production build.
- `yarn build`: build web examples that define a build script.
- `yarn start`: start Expo, React Native Metro, or Next.js production server depending on the example.
- `yarn ios`, `yarn android`, `yarn web`: run Expo or React Native examples on the selected platform.

Validate only the relevant example unless the change intentionally affects multiple examples.
17 changes: 17 additions & 0 deletions docs/agents/git-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Git Workflow

Recent history uses short imperative commit subjects, often with `chore:` for maintenance, for example:

```text
chore: upgrade web-vite example
```

Keep commits focused on one example or one cross-example concern.

Pull requests should include:

- the example or examples changed
- validation commands run
- related issues when available
- screenshots for visible UI changes
- native setup or platform-specific follow-up for iOS or Android changes
30 changes: 30 additions & 0 deletions docs/agents/instruction-audit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Instruction Audit

## Contradictions

No contradictions were found in the previous root `AGENTS.md`.

## Suggested Docs Folder Structure

```text
docs/
agents/
project-structure.md
commands.md
coding-style.md
testing.md
git-workflow.md
instruction-audit.md
```

## Flagged For Deletion

These instructions were removed from the root file because they are better discovered progressively:

- Full example directory descriptions: useful only when changing project structure or choosing an example.
- Complete command list: useful only when running or validating an example.
- Detailed formatting settings: useful only when editing code.
- Test naming details: useful only when adding or reviewing tests.
- Pull request checklist: useful only when preparing contribution metadata.

No previous instruction was deleted as contradictory, too vague, or overly obvious.
12 changes: 12 additions & 0 deletions docs/agents/project-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Project Structure

The root `package.json` defines workspace metadata only. Make application changes in the relevant example directory.

- `examples/native-cli`: React Native CLI app with Android and iOS native projects.
- `examples/native-expo`: Expo React Native app.
- `examples/web-vite`: React web app built with Vite.
- `examples/web-nextjs`: React web app built with Next.js.

Example source files are usually in `src/`, except app entry files such as `App.tsx`, `index.js`, and Next.js `src/app/*`.

Static assets live in each app's `public/`, `src/assets/`, or native asset folders.
20 changes: 20 additions & 0 deletions docs/agents/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Testing

Jest is the unit test runner across examples.

Testing libraries differ by platform:

- React web examples use React Testing Library.
- React Native examples use React Native Testing Library.

Use these naming patterns:

- `*.test.tsx` for unit and behavior tests.
- `*.perf.tsx` for Reassure performance tests.

Add or update unit tests for behavior changes. Add or update performance tests when changing measured rendering paths. When touching measured components, run both:

```sh
yarn test
yarn perf-test
```
11 changes: 2 additions & 9 deletions examples/native-cli/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
/**
* @format
*/

import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import {render} from '@testing-library/react-native';
import App from '../App';

test('renders correctly', async () => {
await ReactTestRenderer.act(() => {
ReactTestRenderer.create(<App />);
});
await render(<App />);
});
9 changes: 4 additions & 5 deletions examples/native-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,19 @@
"@react-native/eslint-config": "0.79.2",
"@react-native/metro-config": "0.79.2",
"@react-native/typescript-config": "0.79.2",
"@testing-library/react-native": "^13.2.0",
"@testing-library/react-native": "^14.0.0",
"@types/jest": "^30.0.0",
"@types/react": "^19.0.0",
"@types/react-test-renderer": "^19.0.0",
"danger": "^13.0.4",
"eslint": "^8.19.0",
"jest": "^30.0.2",
"prettier": "2.8.8",
"react-test-renderer": "19.0.0",
"reassure": "^1.4.0",
"reassure": "^1.5.1",
"test-renderer": "1.0.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
"node": "^22.13.0 || >=24"
},
"packageManager": "yarn@4.9.2"
}
9 changes: 4 additions & 5 deletions examples/native-cli/src/AsyncComponent.perf.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {jest, test} from '@jest/globals';
import {fireEvent, screen} from '@testing-library/react-native';
import {measureRenders} from 'reassure';
Expand All @@ -10,8 +9,8 @@ test('RN CLI - AsyncComponent (10 runs)', async () => {
const scenario = async () => {
const button = screen.getByText('Action');

fireEvent.press(button);
fireEvent.press(button);
await fireEvent.press(button);
await fireEvent.press(button);
await screen.findByText('Count: 2');
};

Expand All @@ -22,8 +21,8 @@ test('RN CLI - AsyncComponent (50 runs)', async () => {
const scenario = async () => {
const button = screen.getByText('Action');

fireEvent.press(button);
fireEvent.press(button);
await fireEvent.press(button);
await fireEvent.press(button);
await screen.findByText('Count: 2');
};

Expand Down
1 change: 0 additions & 1 deletion examples/native-cli/src/TestList.perf.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react';
import {jest, test} from '@jest/globals';
import {measureRenders} from 'reassure';
import {TestList} from './TestList';
Expand Down
5 changes: 2 additions & 3 deletions examples/native-cli/src/TestList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import * as React from 'react';
import {render, screen} from '@testing-library/react-native';
import {expect, test} from '@jest/globals';
import {TestList} from './TestList';

test('TestList', () => {
render(<TestList count={10} />);
test('TestList', async () => {
await render(<TestList count={10} />);

const items = screen.getAllByText(/Item/i);
expect(items).toHaveLength(10);
Expand Down
Loading
Loading