Skip to content

Release v2.0.0 (@W-18482922@)#120

Merged
joeluong-sfcc merged 3 commits into
mainfrom
release/20250811
Aug 14, 2025
Merged

Release v2.0.0 (@W-18482922@)#120
joeluong-sfcc merged 3 commits into
mainfrom
release/20250811

Conversation

@joeluong-sfcc
Copy link
Copy Markdown
Contributor

@joeluong-sfcc joeluong-sfcc commented Aug 11, 2025

This PR release v2.0.0 of the commerce-sdk-core. This is a major version release as we now URL encode path parameters by default.

This PR also fixes a unit test that was using proxyquire as it was no longer compatible with node 22 as it hasn't been actively updated in 6 years. The fix was to create a mock of StaticClient to replicate the behavior. Ideally we use the StaticClient file directly and mock out the fetch call, but unfortunately:

  1. nock doesn't allow us to check the fetchOptions passed into the fetch call which is what we desire
  2. There's no easy way to mock out the fetch import from make-fetch-happen without introducing another testing library like jest
TypeError: Cannot read properties of undefined (reading 'require')
    at Proxyquire.load (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/proxyquire/lib/proxyquire.js:129:72)
    at Suite.<anonymous> (/home/runner/work/commerce-sdk-core/commerce-sdk-core/test/fetchOptions.test.ts:16:34)
    at Object.create (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/mocha/lib/interfaces/common.js:148:19)
    at context.describe.context.context (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/mocha/lib/interfaces/bdd.js:42:27)
    at Object.<anonymous> (/home/runner/work/commerce-sdk-core/commerce-sdk-core/test/fetchOptions.test.ts:13:1)
    at Module._compile (node:internal/modules/cjs/loader:1688:14)
    at Module.m._compile (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/ts-node/src/index.ts:858:23)
    at node:internal/modules/cjs/loader:1820:10
    at Object.require.extensions.<computed> [as .ts] (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/ts-node/src/index.ts:861:12)
    at Module.load (node:internal/modules/cjs/loader:1423:32)
    at Function._load (node:internal/modules/cjs/loader:1246:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1445:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.exports.requireOrImport (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/mocha/lib/nodejs/esm-utils.js:60:20)
    at Object.exports.loadFilesAsync (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/mocha/lib/nodejs/esm-utils.js:103:20)
    at singleRun (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at Object.exports.handler (/home/runner/work/commerce-sdk-core/commerce-sdk-core/node_modules/mocha/lib/cli/run.js:374:5)

Given these limitations I thought the best approach was just to simulate the behavior of StaticClient.

@joeluong-sfcc joeluong-sfcc requested a review from a team as a code owner August 11, 2025 15:52
@joeluong-sfcc joeluong-sfcc merged commit 845dbc5 into main Aug 14, 2025
6 checks passed
@joeluong-sfcc joeluong-sfcc deleted the release/20250811 branch August 14, 2025 19:23
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.

3 participants