Test a local CommonJS remote with @module-federation/rstest, without an HTTP server.
remote/builds an ESM library with declarations and uses Rslib'smfformat to exposeremote/formatPriceandremote/math.host/loads the built container from disk and tests the exposed functions.
- Functions exposed by a Node Module Federation remote can be called from an Rstest test without an HTTP server:
host/tests/federated-modules.test.tsimportsremote/formatPriceandremote/mathand checks their results. - Federated modules are loaded with dynamic
import()through their specifiers, so the Module Federation runtime initializes the container first, matching upstream'sNodeLocal.dynamic.test.tsx.
From host/:
pnpm install
pnpm testFor a remote served over HTTP to a real browser, see the browser example.