Skip to content

Add command and docs about test-examples#574

Merged
dahlia merged 9 commits intofedify-dev:mainfrom
2chanhaeng:main
Feb 20, 2026
Merged

Add command and docs about test-examples#574
dahlia merged 9 commits intofedify-dev:mainfrom
2chanhaeng:main

Conversation

@2chanhaeng
Copy link
Contributor

Summary

Add test-examples and fix examples

Changes

  • Add examples/test-examples
  • Improve @fedify/express, @fedify/fastify.
  • Fix examples that doesn't work.

Benefits

No errors in examples and test all examples at once.
Improve @fedify/express and @fedify/fastify.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run mise test on your machine?

@issues-auto-labeler issues-auto-labeler bot added component/build Build system and packaging component/cli CLI tools related component/testing Testing utilities (@fedify/testing) labels Feb 19, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @2chanhaeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a robust testing framework for all example projects, ensuring their reliability and ease of use. It also includes critical fixes and minor enhancements across various examples and core integration packages, improving overall stability and developer experience. The changes streamline the development workflow by providing automated verification for examples and refining how host information is handled in web framework integrations.

Highlights

  • New Example Test Runner: A new Deno-based script, examples/test-examples/mod.ts, has been added to automate the testing of all example projects, including server startup, tunnel creation, and federation lookup. This ensures the examples remain functional and provides a consistent testing mechanism.
  • Documentation for Example Testing: Documentation has been added to CONTRIBUTING.md outlining how to run the new example tests using mise run test:examples, making it easier for contributors to verify example functionality.
  • Example Project Fixes and Improvements: Several example projects have received fixes, including corrected import paths for @fedify/vocab types, updated package imports for framework integrations (@fedify/fastify, @fedify/h3), and configuration adjustments for Next.js and SvelteKit to ensure proper operation.
  • Core Package Host Header Handling: The @fedify/express and @fedify/nestjs packages have been improved to prioritize req.hostname over req.header("Host") when constructing request URLs, enhancing robustness in various deployment environments.
  • Dependency Updates: The pnpm-lock.yaml file has been updated to reflect changes in dependencies, including new additions like @fedify/cfworkers for the Cloudflare Workers example and adjustments to ESLint-related packages.
Changelog
  • CONTRIBUTING.md
    • Added a new section detailing how to test example projects using mise run test:examples.
  • examples/cloudflare-workers/package.json
    • Added @fedify/cfworkers as a workspace dependency.
  • examples/custom-collections/main.ts
    • Moved Note import from @fedify/fedify to @fedify/vocab.
  • examples/elysia/app.ts
    • Updated the software.version field in NodeInfo from an object to a string.
  • examples/fastify/index.ts
    • Changed the import path for fedifyPlugin to use the published package name @fedify/fastify.
  • examples/h3/index.ts
    • Updated import statements for integrateFederation, onError from ../src to @fedify/h3, and federation from ./federation to ./federation.ts.
  • examples/hono-sample/main.ts
    • Updated import path for createFederation and MemoryKvStore from @fedify/fedify/federation to @fedify/fedify.
  • examples/next14-app-router/next.config.mjs
    • Added a new Next.js configuration file in .mjs format.
  • examples/next14-app-router/next.config.ts
    • Removed the old Next.js configuration file in .ts format.
  • examples/next15-app-router/tsconfig.json
    • Included app/.well-known/**/*.ts in the include array for TypeScript compilation.
  • examples/sveltekit-sample/src/lib/federation.ts
    • Moved PUBLIC_COLLECTION import from @fedify/fedify to @fedify/vocab.
  • examples/sveltekit-sample/src/lib/fetch.ts
    • Moved Note import from @fedify/fedify to @fedify/vocab.
  • examples/sveltekit-sample/src/lib/store.ts
    • Moved Note and Person type imports from @fedify/fedify to @fedify/vocab.
  • examples/sveltekit-sample/src/routes/users/[identifier]/posts/+page.server.ts
    • Moved Create and Note imports from @fedify/fedify to @fedify/vocab.
  • examples/sveltekit-sample/vite.config.ts
    • Added server.allowedHosts: true to the Vite configuration.
    • Reordered imports.
  • examples/test-examples/mod.ts
    • Added a new Deno-based test runner script for example projects, including server startup, tunnel creation, and federation lookup.
  • mise.toml
    • Added a new test:examples task to run the example test runner.
  • packages/express/src/index.ts
    • Adjusted the logic for constructing the request URL to prioritize req.hostname over req.header("Host").
  • packages/nestjs/src/fedify.middleware.ts
    • Reordered imports for Federation.
    • Adjusted the logic for constructing the request URL to prioritize req.hostname over req.header("Host").
  • pnpm-lock.yaml
    • Updated dependency resolutions, including changes related to eslint-import-resolver-typescript and eslint-plugin-import.
Activity
  • The pull request introduces a new testing mechanism for example projects and includes several fixes and improvements across various examples and core packages.
  • The author has marked documentation and regression tests as complete.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a test runner for example projects and fixes several issues across the examples to ensure they work correctly. It also includes improvements to the Express and NestJS integrations. While the addition of the test runner is a great improvement for maintainability, there is a regression in how URLs are reconstructed in the Express and NestJS middlewares, which causes port numbers to be lost. Additionally, the new test runner script has some cross-platform compatibility issues on Windows that should be addressed.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dahlia dahlia added this to the Fedify 2.0 milestone Feb 19, 2026
Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Could you resolve the conflict on pnpm-lock.yaml? It would be easily resolvable by running pnpm i.

@dahlia dahlia merged commit 0d27c2d into fedify-dev:main Feb 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/build Build system and packaging component/cli CLI tools related component/testing Testing utilities (@fedify/testing)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments