Skip to content

Migrate All Test Suites From Jest to the Node Test Runner - #153

Merged
AndrewRedican merged 123 commits into
mainfrom
week-2026-08-31
Sep 3, 2026
Merged

AndrewRedican merged 123 commits into
mainfrom
week-2026-08-31

Conversation

@AndrewRedican

Copy link
Copy Markdown
Owner

Description

Replaces jest with a workspace-owned test runtime built on node:test. A new tools/testing package provides the runner (CLI, argv parsing, config loading, reporter), a jest-compatible mock API (jest.mock/doMock/requireMock/requireActual/resetModules, mock functions, spies, fake timers), module-replacement loader hooks, expect matchers, and per-environment DOM installation. Every library suite and every package-e2e format spec now runs on this runtime through a new @hyperfrontend/package:test executor, and the jest toolchain (configs, setup files, plugins, dependencies) is torn down across the repo, shrinking the workspace lockfiles substantially.

Type of Change

✨ Feature | 🐛 Bug fix | ♻️ Refactor | 🔧 Build/Config | 📝 Docs

Changes Made

  • Add the node:test workspace test runtime (tools/testing): runner CLI and config, jest-compatible mocking (module replacement via loader hooks, mock functions, spies, fake timers), expect matchers, DOM environment support, and coverage merged by file with stable identities
  • Add a test executor to @hyperfrontend/package for the node runtime and make it the workspace default test target; new library and e2e scaffolding generates onto the node runner
  • Migrate all library suites (builder, features, network-protocol, cryptography, versioning, eslint-rules, project-scope, and the utility libs) to the node test runner, setting coverage thresholds from the stable merged reports
  • Migrate all package-e2e projects to run their ESM/CJS/IIFE/UMD format specs on the node runner, with runtime-agnostic shared e2e helpers and an explicit alias map for e2e resolution
  • Tear down the jest toolchain: delete jest configs and setup files, drop jest lint entries and plugin exclusions, retire the jest-environment tag registration, and remove jest dependencies from the workspace and per-project lockfiles
  • Fix lib-builder bundling: bounded dedupe ownership to entry-reachable modules with free-ref classification, and gave bundled CJS deps' ESM chunks their named exports and module-scope globals
  • Hash the builder toolchain into library build inputs; expose maxCommitFallback on the version executors and widen the versioning commit window to 170
  • Replace angle-bracket type assertions with as-expressions and remove the now-unneeded prefer-angle-bracket-assertion rule
  • Track published @hyperfrontend/features 0.8.0 in the clock and heartbeat demos, revendor their shells, and track the published 1.0.0 utility libraries in docs-site
  • Record showcase findings F-022 through F-025 and document the mocking differences, spec import convention, and reporting changes the migration exposed

Testing

The entire change is exercised by the migrated suites themselves: every library and e2e project now runs green on the node test runner, with coverage gated against thresholds set from stable merged reports (lib-builder branches raised to 97). The test runtime in tools/testing ships with its own specs covering the runner, argv parsing, mock registry and declarations, resolver, spies, timers, and matchers.

Checklist

  • I have performed a self-review of my code
  • I have added/updated tests as needed
  • I have updated relevant documentation
  • I have used npm run commit for conventional commit messages

AI Assistance

Claude leveraged significantly for this refactor work.

Additional Notes

  • The jest toolchain is fully removed; any downstream tooling still invoking jest configs will no longer find them. Test targets resolve through the @hyperfrontend/package:test executor.
  • Workspace and per-project lockfiles shrink significantly from dropping the jest dependency tree.
  • Behavioral differences between jest and the node runtime (mock hoisting, DOM globals, base64 helpers, timer draining) are documented in tools/testing.

📝 CLA Requirement

By submitting this pull request, you acknowledge that:

  • You have read and agree to sign our Contributor License Agreement (CLA)
  • The CLA Assistant bot will automatically check your signature status
  • If you haven't signed yet, the bot will provide instructions in the comments
  • By signing, you grant the project maintainer exclusive rights to your contributions

For more information, see our Contributing Guide.


Thank you for contributing to hyperfrontend! 🚀

@vercel

vercel Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs-site Ready Ready Preview Sep 3, 2026 7:58pm UTC

Request Review

@nx-cloud

nx-cloud Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 21eeb42

Command Status Duration Result
nx run-many -t=e2e --projects=@hyperfrontend/wo... ✅ Succeeded 2m 7s View ↗
nx run-many -t=build --projects=@hyperfrontend/... ✅ Succeeded 1h 42m 11s View ↗
nx run-many -t=test --projects=@hyperfrontend/w... ✅ Succeeded 4m 51s View ↗
nx run-many -t=typecheck --projects=@hyperfront... ✅ Succeeded 2m 20s View ↗
nx run-many -t=lint --projects=@hyperfrontend/w... ✅ Succeeded 12s View ↗
nx version-check lib-time-utils ✅ Succeeded 1s View ↗
nx version-check lib-json-utils ✅ Succeeded 1s View ↗
nx version-check lib-string-utils ✅ Succeeded 1s View ↗
Additional runs (16) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-03 21:48:34 UTC

Comment thread tools/testing/src/hooks/paths.ts Fixed
Comment thread libs/builder/src/bundle/run-bundle-phase.spec.ts Fixed
Comment thread libs/nexus/src/broker/factory.browser.spec.ts Fixed
import type { FlowContext } from '../models/types'
import { describe, expect, it, jest } from '@hyperfrontend/testing'
@AndrewRedican
AndrewRedican merged commit bd2b1bf into main Sep 3, 2026
15 checks passed
@AndrewRedican
AndrewRedican deleted the week-2026-08-31 branch September 3, 2026 22:13

This branch was successfully deployed

1 active deployment
Preview — 21eeb42a Deployed Sep 3, 2026 by vercel[bot]
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