test(webauthn): select mock.module option shape by Node version (#692)#720
Merged
Merged
Conversation
`options.exports` and the `DeprecationWarning` for the legacy `namedExports`/`defaultExport` keys landed in Node 25.9.0 (nodejs/node #61727). CI pins Node 22, which only understands `namedExports`, while local toolchains on Node 25.9+ trip the deprecation warning under the zero-warnings policy. Feature-detect the running Node version and pass `exports` where supported, falling back to `namedExports` on Node 22. The CI runtime takes the unchanged `namedExports` branch; newer local runs go warning-free. Closes #692 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
infra/lambdas/webauthn_demo/tests/verify-success.test.mjsmocked@simplewebauthn/serverviamock.module(..., { namedExports }). The singleexportsoption — and theDeprecationWarningfor the legacynamedExports/defaultExportkeys — landed in Node 25.9.0 (nodejs/node#61727, released 2026-04-01). CI pins Node 22 (only understandsnamedExports, silently ignoresexports); local toolchains on Node 25.9+ emit the deprecation warning, tripping the zero-warnings policy onscripts/ci-local.sh.This selects the option shape the running Node supports:
namedExportsbranch — byte-equivalent to the prior code, stays green.exportsbranch — warning-free.A naive swap to
exportswas rejected: it silently no-ops the mock on Node 22 (unknown option ignored →verified:truenever forced → the four success tests fail). Verified empirically against the realmock.moduleAPI on Node 22 vs 25.9.Verification
Exact CI command on local Node 25.9.0:
Closes #692
🤖 Generated with Claude Code