Repository navigation
test(compat): add SSR import smoke tests for framework packages - #250
Conversation
Import every packages/sdk-* companion in a server-only Node process with window, document, storage and browser crypto trapped for the import, then render or instantiate its minimal SSR path. Runs as a step of pnpm test:compat, so the compat CI job covers it on Node 20, 22 and 24. sdk-vue, sdk-svelte and sdk-solid are recorded as known import failures: they import Wraith, WraithAgent and Chain from @wraith-protocol/sdk, which stopped exporting them when sdk-agent became its own package. The entries are strict, so the check fails once those imports are fixed until the entries are removed. Closes wraith-protocol#248
|
@lowfjell Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
truthixify
left a comment
There was a problem hiding this comment.
The merge ref passes the full build and compatibility suite on my local Node 24 run. The new check discovers every companion, isolates imports in fresh server processes, fails on authored import-time browser-global reads, and exercises the supported SSR paths. The three existing #249 failures are strict expected failures, so a successful import or a changed failure will make the suite fail until the exception is removed.
truthixify
left a comment
There was a problem hiding this comment.
The merge ref passes the full build and compatibility suite on my local Node 24 run. The new check discovers every packages/sdk-* companion, isolates imports in fresh server processes, fails on authored import-time browser-global reads, and exercises the supported SSR paths. The three existing #249 failures are strict expected failures, so a successful import or a changed failure will make the suite fail until the exception is removed.
Why
Framework companions can pass their jsdom tests while breaking server imports by reading browser globals. This adds a server-only import and minimal SSR smoke check to the existing
pnpm test:compatjob on Node 20, 22, and 24.Closes #248
What changed
packages/sdk-*companion and require an SSR scenario for it.Scope
React and agent import and render successfully. Vue, Svelte, and Solid still fail to import because of #249. Each has a strict expected-failure entry for the missing core exports. A successful import or a different error fails the check, requiring removal or investigation of the entry.
The React Native entry is excluded. Fixing #249 remains separate. The three affected SSR scenarios cannot run normally until that fix lands.
Verification
Before this change,
test:compatdid not import framework companions. With this change, addingwindow.x;at the top of the React entry makes the full command exit 1 and report:After reverting the planted read,
test:compatpasses again.Verified locally on Node 22 after
pnpm install --ignore-scripts:pnpm build,pnpm test:compat, andpnpm format:checkpass.pnpm testpasses with 1,453 tests plus 10 Svelte tests; five existing tests are skipped.pnpm api:check,pnpm test:types,pnpm test:exports, andpnpm pack:checkpass.Revert
Safe to revert. Only compatibility scripts and documentation change. No published files, dependencies, or public APIs change, so no version bump is needed.