Skip to content

test: replace dead duplicate signature test, drop ts-node, require node 22 - #219

Merged
dantio merged 1 commit into
masterfrom
test/drop-ts-node-and-fix-signature-test
Aug 1, 2026
Merged

test: replace dead duplicate signature test, drop ts-node, require node 22#219
dantio merged 1 commit into
masterfrom
test/drop-ts-node-and-fix-signature-test

Conversation

@dantio

@dantio dantio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

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 known had a body byte-identical to the content-digest test above it — it asserted nothing new and never reached the branch its name described.

That branch is in fact unreachable: getSignatureParams only ever emits @method/@path/@authority, all of which the switch in generateBaseString handles, so default: 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 missing x-ebay-signature-key header on the no-payload path. When payload is null, content-digest drops 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-node was only needed by .mocharc.json's loader, which #218 replaced with vitest. Removed from devDependencies, along with the now-orphaned "ts-node": {"esm": true} block in tsconfig.json.

The examples needed a replacement runner. Bare node does not work even on 22+ — native type stripping does not rewrite the .js import specifiers the examples use (import eBayApi from '../../../src/eBayApi.js'), so it fails with ERR_MODULE_NOT_FOUND. Swapped in tsx, which resolves them. Still dev-only. Also dropped the stale "Node 20" section from examples/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 emit EBADENGINE for 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 — pass
  • npm run lint — pass
  • npm ci — clean, 0 vulnerabilities
  • No ts-node references remain outside the lockfile/CHANGELOG

…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.
@dantio
dantio merged commit 6ea7ef4 into master Aug 1, 2026
1 check passed
@dantio
dantio deleted the test/drop-ts-node-and-fix-signature-test branch August 1, 2026 12:16
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