test: replace dead duplicate signature test, drop ts-node, require node 22 - #219
Merged
Merged
Conversation
…de 22 The 'pseudo header is not known' test had a body identical to the content-digest test above it, so it asserted nothing new and never reached the branch its name described. That branch is unreachable: getSignatureParams only ever emits @method/@path/@authority, all of which the switch handles. Replace it with a case that is reachable and untested — a missing x-ebay-signature-key header on the no-payload path. ts-node was only needed by .mocharc.json's loader, which vitest replaced. Drop it along with the now-unused "ts-node" block in tsconfig.json, and point the examples at tsx: native node type stripping cannot rewrite the .js specifiers the examples import through. Bump engines.node to >= 22.0.0 to match the CI matrix and @types/node.
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.
Follow-up to #218, addressing review findings from the vitest migration.
Replace the dead duplicate signature test
should throw an error pseudo header is not knownhad a body byte-identical to thecontent-digesttest above it — it asserted nothing new and never reached the branch its name described.That branch is in fact unreachable:
getSignatureParamsonly ever emits@method/@path/@authority, all of which the switch ingenerateBaseStringhandles, sodefault: throw new Error('Unknown pseudo header ...')(src/api/digitalSignature.ts:77) cannot be hit by any input. Rather than mock module internals to reach dead code, this replaces it with a case that is both reachable and genuinely untested: a missingx-ebay-signature-keyheader on the no-payload path. Whenpayloadis null,content-digestdrops out of the signature params, so the key header is the first one checked.Mutation-checked: altering the expected message fails the test, restoring it passes.
Drop ts-node
ts-nodewas only needed by.mocharc.json's loader, which #218 replaced with vitest. Removed fromdevDependencies, along with the now-orphaned"ts-node": {"esm": true}block intsconfig.json.The examples needed a replacement runner. Bare
nodedoes not work even on 22+ — native type stripping does not rewrite the.jsimport specifiers the examples use (import eBayApi from '../../../src/eBayApi.js'), so it fails withERR_MODULE_NOT_FOUND. Swapped intsx, which resolves them. Still dev-only. Also dropped the stale "Node 20" section fromexamples/README.md.Bump engines.node to >= 22.0.0
Matches the CI matrix and the
@types/node^22 bump from #218. Note this is consumer-facing: npm will emitEBADENGINEfor installs on Node < 22.Test plan
Verified from a clean
npm ci:npm test— 1371 passed, 9 files (unchanged count vs. master)npm run typecheck— passnpm run lint— passnpm ci— clean, 0 vulnerabilitiests-nodereferences remain outside the lockfile/CHANGELOG