Skip to content

Recommend node:test over @fedify/fixture for most packages#780

Open
dahlia wants to merge 1 commit into
fedify-dev:mainfrom
dahlia:docs/test-harness
Open

Recommend node:test over @fedify/fixture for most packages#780
dahlia wants to merge 1 commit into
fedify-dev:mainfrom
dahlia:docs/test-harness

Conversation

@dahlia
Copy link
Copy Markdown
Member

@dahlia dahlia commented May 27, 2026

Background

@fedify/fixture originally provided a test() wrapper because Deno.test() and Node.js's node:test were not compatible. The wrapper let the same tests run across runtimes. Deno and Bun now support node:test and node:assert/strict, so most packages can use those APIs directly.

The exception is @fedify/fedify and @fedify/vocab. Those packages register tests in a testDefinitions array, which the Cloudflare Workers harness in packages/fedify/src/cfworkers/ runs later. Plain node:test calls don't populate that array, so replacing the fixture wrapper there would drop CF Workers test coverage.

Changes

This PR updates three documentation files:

  • AGENTS.md (= CLAUDE.md): Changes the testing guidance to recommend node:test and node:assert/strict for most packages, with an explicit exception for @fedify/fedify and @fedify/vocab.
  • CONTRIBUTING.md: Renames “Writing tests with @fedify/fixture” to “Writing tests with node:test” and documents the rule: use node:test by default, and use @fedify/fixture's test() only where the CF Workers harness depends on testDefinitions.
  • .agents/skills/create-integration-package/SKILL.md: Updates the integration-package guidance to use node:test. Integration packages don't include the CF Workers harness.

The fixture helpers that don't register tests (mockDocumentLoader, TestSpanExporter, createTestTracerProvider) don't change. They can still be imported from any *.test.ts file regardless of which runner is used.

Deno, Node.js, and Bun all support node:test and node:assert/strict
natively, so there is no longer a need to use @fedify/fixture's test()
wrapper in most packages.  Update AGENTS.md, CONTRIBUTING.md, and the
create-integration-package skill to reflect this:

- Default guidance: use node:test + node:assert/strict directly.
- Exception: @fedify/fedify and @fedify/vocab must keep using
  @fedify/fixture's test() because their Cloudflare Workers harness
  relies on the testDefinitions registry that fixture populates.
- @fedify/fixture helpers (mockDocumentLoader, TestSpanExporter, etc.)
  remain available for any *.test.ts file regardless of test runner.

Assisted-by: Claude Code:claude-sonnet-4-6
@dahlia dahlia requested review from 2chanhaeng and sij411 May 27, 2026 10:36
@dahlia dahlia self-assigned this May 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Three contributor documentation files update test runner guidance to standardize on Node's node:test and node:assert/strict across Deno/Node.js/Bun environments, while explicitly carving out a Cloudflare Workers exception for @fedify/fedify and @fedify/vocab that requires @fedify/fixture's test() wrapper.

Changes

Test Runner Standardization Guidance

Layer / File(s) Summary
Primary test authoring guidance with example
CONTRIBUTING.md
node:test/node:assert/strict becomes the primary recommendation for new test files, with a representative test snippet and mise run test:* command documentation. Cloudflare Workers exception is introduced: @fedify/fedify and @fedify/vocab must use @fedify/fixture's test() wrapper to populate the Workers harness, and mockDocumentLoader() is noted as an available utility.
Agent-level test runner requirements and references
AGENTS.md
Type Safety/Testing section recommends node:test with the Workers exception; Writing tests section references CONTRIBUTING.md guidance and lists @fedify/fixture utilities; Testing requirements section formalizes the runner rule, the Workers exception for @fedify/fedify/@fedify/vocab, and clarifies which fixture utilities may be imported in *.test.ts files.
Integration package test runner guidance
.agents/skills/create-integration-package/SKILL.md
Integration package skill guidance shifts from @fedify/fixture as default to recommending node:test and node:assert/strict, reinforces that @fedify/fixture may only be imported in *.test.ts helper files, and documents fallback for cases where node:test is impractical.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • fedify-dev/fedify#747: Both PRs update contributor guidance around @fedify/fixture imports—restricting to **/*.test.ts and clarifying test harness usage—with #747 additionally adding a mise run check:fixture-usage enforcement checker.

Suggested labels

type/documentation, component/testing

Suggested reviewers

  • sij411
  • 2chanhaeng
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: recommending node:test as the default test runner over @fedify/fixture for most packages in the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description is directly related to the changeset, explaining the background, rationale, and specific changes to three documentation files regarding test harness recommendations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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 updates the testing documentation across several files (SKILL.md, AGENTS.md, and CONTRIBUTING.md) to transition the preferred testing framework from @fedify/fixture to the built-in node:test and node:assert/strict modules, which are supported natively by Deno, Node.js, and Bun. It also documents the exception for @fedify/fedify and @fedify/vocab packages, which must continue using @fedify/fixture due to Cloudflare Workers test harness requirements. The reviewer feedback suggests replacing em dashes () with alternative punctuation (such as semicolons, colons, or parentheses) in the updated documentation files to improve prose formatting.

Comment thread .agents/skills/create-integration-package/SKILL.md
Comment thread .agents/skills/create-integration-package/SKILL.md
Comment thread AGENTS.md
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 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.

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