Skip to content

Commit 4005dbe

Browse files
hi-ogawaclaude
andauthored
docs(rsc): add CONTRIBUTING.md (#613)
Co-authored-by: Claude <[email protected]>
1 parent 26326b3 commit 4005dbe

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,7 @@ Some errors are masked and hidden away because of the layers of abstraction and
132132
In many test cases, we need to mock dependencies using `link:` and `file:` protocols. `pnpm` treats `link:` as symlinks and `file:` as hardlinks. To test dependencies as if they were copied into `node_modules`, use the `file:` protocol. Otherwise, use the `link:` protocol.
133133

134134
For a mock dependency, make sure you add a `@vitejs/test-` prefix to the package name. This will avoid possible issues like false-positive alerts.
135+
136+
## Contributing to `@vitejs/plugin-rsc`
137+
138+
See [CONTRIBUTING.md](packages/plugin-rsc/CONTRIBUTING.md) in the `@vitejs/plugin-rsc` package for specific guidelines on contributing to the React Server Components plugin.

packages/plugin-rsc/CONTRIBUTING.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Contributing to @vitejs/plugin-rsc
2+
3+
This guide provides essential tips for contributors working on the RSC plugin.
4+
5+
## Testing
6+
7+
### E2E Test Setup
8+
9+
Tests use Playwright and are located in `e2e/` and use `examples` as test apps.
10+
11+
#### Test Fixture Patterns
12+
13+
- `examples/basic` - comprehensive test suite for the RSC plugin
14+
- `examples/starter` - lightweight base template for writing more targeted tests using `setupInlineFixture` utility
15+
- `examples/e2e/temp/` - base directory for test projects
16+
17+
### Adding New Test Cases
18+
19+
**Expanding `examples/basic` (for comprehensive features)**
20+
Best for features that should be part of the main test suite. `examples/basic` is mainly used for e2e testing:
21+
22+
1. Add your test case files to `examples/basic/src/routes/`
23+
2. Update the routing in `examples/basic/src/routes/root.tsx`
24+
3. Add corresponding tests in `e2e/basic.test.ts`
25+
26+
**Using `setupInlineFixture` (for specific edge cases)**
27+
Best for testing specific edge cases or isolated features. See `e2e/ssr-thenable.test.ts` for the pattern.
28+
29+
<!-- TODO: mention unit test -->
30+
31+
## Development Workflow
32+
33+
<!-- TODO: mention playwright vscode extension? -->
34+
35+
```bash
36+
# Build packages
37+
pnpm dev # pnpm -C packages/plugin-rsc dev
38+
39+
# Run examples
40+
pnpm -C packages/plugin-rsc/examples/basic dev # build / preview
41+
pnpm -C packages/plugin-rsc/examples/starter dev # build / preview
42+
43+
# Run all e2e tests
44+
pnpm -C packages/plugin-rsc test-e2e
45+
46+
# Run with UI (this allows filtering interactively)
47+
pnpm -C packages/plugin-rsc test-e2e --ui
48+
49+
# Run specific test file
50+
pnpm -C packages/plugin-rsc test-e2e basic
51+
52+
# Run with filter/grep
53+
pnpm -C packages/plugin-rsc test-e2e -g "hmr"
54+
55+
# Test projects created with `setupInlineFixture` are locally runnable. For example:
56+
pnpm -C packages/plugin-rsc/examples/e2e/temp/react-compiler dev
57+
```
58+
59+
## Tips
60+
61+
- Prefer `setupInlineFixture` for new tests - it's more maintainable and faster
62+
- The `examples/basic` project contains comprehensive test scenarios
63+
- Dependencies for temp test projects are managed in `examples/e2e/package.json`

0 commit comments

Comments
 (0)