Skip to content

Convert to native ESM (vitest + oxc toolchain) - #41

Open
damusix wants to merge 2 commits into
hapijs:masterfrom
damusix:esm-conversion
Open

Convert to native ESM (vitest + oxc toolchain)#41
damusix wants to merge 2 commits into
hapijs:masterfrom
damusix:esm-conversion

Conversation

@damusix

@damusix damusix commented Jul 30, 2026

Copy link
Copy Markdown

Wave 2 of the ecosystem ESM migration. The tooling swap rides along because @hapi/lab cannot run ESM — it isn't separable from the module-system change.

Error-message assertions became anchored regexes rather than bare strings: @hapi/code's .to.throw(string) matched exactly, vitest's toThrow(string) matches a substring, and several of these messages are strict prefixes of others (Invalid content-type header vs …: duplicate parameter). Bare strings stay green while no longer testing which error was thrown.

oxlint/oxfmt sit above the versions in the vise/b64 PRs because @hapi/oxc-plugin@1.0.2 raised its peer floor. TypeScript stays on ^6.0.3 to match the other converted packages.

damusix added 2 commits July 30, 2026 08:21
@hapi/lab cannot run ESM, so the module-system switch carries the tooling
migration with it: vitest + @vitest/coverage-v8 for tests, oxlint + oxfmt via
the shared @hapi/oxc-plugin for lint/format.

Ships unbuilt from src/index.mjs with a hand-written src/index.d.mts — content
previously shipped no types at all. Node baseline moves to >=22.

Error-message assertions are anchored regexes rather than bare strings:
@hapi/code's .to.throw(string) matched the message exactly, vitest's
toThrow(string) matches a substring, and several of these messages are strict
prefixes of each other ('Invalid content-type header' vs '...: duplicate
parameter'), which would have silently weakened the assertions.
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.

1 participant