Convert to native ESM (vitest + oxc toolchain) - #41
Open
damusix wants to merge 2 commits into
Open
Conversation
@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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wave 2 of the ecosystem ESM migration. The tooling swap rides along because
@hapi/labcannot 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'stoThrow(string)matches a substring, and several of these messages are strict prefixes of others (Invalid content-type headervs…: duplicate parameter). Bare strings stay green while no longer testing which error was thrown.oxlint/oxfmt sit above the versions in the
vise/b64PRs because@hapi/oxc-plugin@1.0.2raised its peer floor. TypeScript stays on^6.0.3to match the other converted packages.