-
-
Couldn't load subscription status.
- Fork 191
test(rsc): port transform tests from waku #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Port server action test cases from Waku's vite-plugin-rsc-transform-internals.test.ts to ensure @vitejs/plugin-rsc covers the same use cases as Waku adoption progresses. Test coverage includes: - Top-level 'use server' directives - Inline server actions (function declarations, arrow functions, anonymous functions) - Server actions in objects - Various function declaration patterns - Mixed server/client scenarios - Closure capture and variable hoisting All 8 new test cases pass alongside existing tests. Verified with both `pnpm test` and `pnpm tsc`. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add missing 'inline use server (const function expression)' test case to match Waku coverage - Add skipped client transform tests for reference documentation - Now covers 9 server action test cases + 3 client reference examples - All active tests pass (12 total, 3 skipped) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Add @ts-expect-error comments for unused variables in documentation-only skipped tests. All tests pass and TypeScript compiles without errors. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Reorder test cases to exactly match the sequence in Waku's vite-plugin-rsc-transform-internals.test.ts for easier comparison and maintenance consistency. Order now matches: 1. no transformation 2. top-level use server 3. server action in object 4. top-level use server and inline use server 5-9. inline use server variations (function declaration, const function expression, const arrow function, anonymous arrow function, various patterns) All tests continue to pass with proper snapshots. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Change __registerServerReference to 81712register for cleaner snapshots - Remove unused testTransform options (rejectNonAsyncFunction, encode) - Simplify testTransform function signature to just accept input string - All tests continue to pass with simplified assertions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
The test file covers broader RSC transform functionality ported from Waku's vite-plugin-rsc-transform-internals.test.ts, not just server actions. It tests server actions, client references, and various RSC patterns. The name 'waku.test.ts' better reflects that this is a comprehensive port of Waku's RSC transform test cases for compatibility verification. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Update test structure to exactly match Waku's original: 1. Change describe block names: - 'transformServerActionServer' → 'internal transform function for server environment' - 'client transform examples (for reference)' → 'internal transform function for client environment' 2. Add missing 'top-level use client' test in server environment (skipped) 3. Update client environment tests to match original sequence: - 'no transformation' (skipped) - 'top-level use server' (skipped) - 'top-level use server for SSR' (skipped) 4. Remove duplicate client test content Final structure matches Waku's vite-plugin-rsc-transform-internals.test.ts: - Server environment: 10 tests (9 active + 1 skipped) - Client environment: 3 tests (all skipped for reference) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Replace commented expected outputs with proper string literals for better documentation and readability. This makes it easier to understand what the Waku transforms produce for each test case. Changes: - 'top-level use client' server transform: registerClientReference calls with error-throwing stubs - 'top-level use server' client transform: createServerReference calls - 'top-level use server for SSR': error-throwing stubs for SSR environment All outputs copied directly from Waku's actual test snapshots. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Enable previously skipped tests for complete coverage - Implement proper client environment transforms using vitePluginUseServer approach - Unify transformDirectiveProxyExport usage with single testDirectiveTransform utility - Enable keep option for 'use client' directive to preserve original code structure - All 13 tests now passing with comprehensive RSC transform coverage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Change server environment $$register calls to $runtime - Maintain consistent runtime interface across all transforms - All server and client transforms now use unified $runtime pattern 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Port server action test cases from Waku's
vite-plugin-rsc-transform-internals.test.tsto ensure@vitejs/plugin-rsccovers the same use cases as Waku adoption progresses.Test Coverage
Added 8 comprehensive test cases covering:
Test Verification
✅ All 42 tests pass (8 new + 34 existing)
✅
pnpm -C packages/plugin-rsc test- successful✅
pnpm -C packages/plugin-rsc tsc- no type errorsContext
As Waku adopts
@vitejs/plugin-rsc, these tests ensure feature parity and compatibility for server action transforms across both projects.🤖 Generated with Claude Code