Skip to content

Conversation

@au-re
Copy link
Owner

@au-re au-re commented Oct 27, 2025

This pull request introduces several improvements and updates across the codebase, focusing on Storybook configuration, documentation enhancements, transferables demo implementation, dependency updates, and improved test coverage. The changes modernize the Storybook setup, add interactive examples for file transfer using transferables, update dependencies for compatibility and better tooling, and strengthen the test suite for core connection logic.

Storybook and Documentation Improvements:

  • Updated Storybook configuration to use @storybook/addon-docs instead of deprecated or less relevant addons, and switched imports in documentation files to use @storybook/addon-docs/blocks for better compatibility. (.storybook/main.ts, docs/GettingStarted.mdx, docs/NestedAPIDemo.mdx, package.json) [1] [2] [3] [4]
  • Added a new documentation page, docs/ManagingFileTransfers.mdx, explaining how to use withTransferable for efficient file and binary data transfers between host and worker, including code samples and an interactive demo.

Transferables Demo Implementation:

  • Added FileTransferExample.tsx and a corresponding worker implementation to demonstrate transferring files between host and worker using transferables, including UI for file selection and download. (docs/examples/Transferables/FileTransferExample.tsx, docs/examples/Transferables/worker.ts) [1] [2]

Dependency and Tooling Updates:

  • Updated Storybook, ESLint, Vitest, and related dependencies to their latest major versions for improved stability and compatibility. Added eslint-plugin-storybook and configured recommended rules for Storybook in ESLint. (package.json, eslint.config.js) [1] [2] [3]
  • Added a new npm script for running tests with coverage using Vitest. (package.json)

Core Logic and Example Enhancements:

  • Improved connection logic in IframesExample.tsx to handle parallel connections to multiple iframes, with better error handling and cleanup. (docs/examples/Iframes/IframesExample.tsx)
  • Enhanced iframe target validation in src/host.ts to properly support inline iframes (srcdoc/about:blank). (src/host.ts)

Testing Improvements:

  • Rewrote and expanded tests for guest.connect to verify handshake, RPC wiring, and cleanup behavior using spies and mocks for all relevant helpers and RPC methods. (tests/guest.test.ts)
  • Minor improvement to handshake tests by importing additional constants. (tests/handshake.test.ts)

@au-re au-re requested a review from Copilot October 27, 2025 11:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the project's documentation infrastructure and enhances test coverage for edge cases in the handshake and connection management logic. The changes migrate Storybook from v8 to v9, add test coverage configuration, and introduce new documentation examples for file transfers.

  • Migrated Storybook dependencies from v8 to v9 and updated related imports
  • Added comprehensive test coverage configuration with minimum thresholds (70% for lines/functions/statements, 60% for branches)
  • Enhanced test coverage for handshake edge cases, connection cleanup, and origin validation scenarios

Reviewed Changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vitest.config.ts Added test coverage configuration with v8 provider and minimum thresholds
tests/handshake.test.ts Added comprehensive edge case tests for handshake failures, origin validation, and connection cleanup
tests/guest.test.ts Replaced placeholder tests with detailed guest connection and cleanup tests
src/host.ts Enhanced iframe validation logic to handle inline content (srcdoc/about:blank)
package.json Updated dependencies to latest versions (Storybook v9, Vitest v4, Node 22) and added coverage script
eslint.config.js Integrated eslint-plugin-storybook configuration
docs/examples/Transferables/* Added new example demonstrating file transfer with transferables
docs/examples/Iframes/IframesExample.tsx Improved connection handling with parallel connections and error handling
docs/*.mdx Updated Storybook imports to use addon-docs/blocks path
.storybook/* Updated Storybook configuration and type imports for v9

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@au-re au-re changed the title update docs and tests update docs, dependencies and tests Oct 27, 2025
@au-re au-re merged commit 551c16b into master Oct 27, 2025
1 check passed
@au-re au-re deleted the update-docs-and-tests branch October 27, 2025 11:57
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.

2 participants