Repository navigation
test: remove --proxyquire-shim from common, bigquery, datastore, and dns - #9643
Draft
danieljbruce wants to merge 4 commits into
Draft
danieljbruce wants to merge 4 commits into
danieljbruce wants to merge 4 commits into
Conversation
This was referenced Oct 15, 2026
Contributor
There was a problem hiding this comment.
Code Review
This pull request replaces the external proxyquire dependency with a custom local implementation across multiple packages and updates the test scripts to remove the --proxyquire-shim flag. Feedback on the new proxyquire.ts files highlights a bug in the hasOwn helper, which currently only checks for 'object' types and fails to recognize function-based stubs, thereby ignoring @noCallThru and @global behaviors. It is recommended to update hasOwn to support both 'object' and 'function' types.
danieljbruce
added this pull request to stack #9647
October 15, 2026 21:18
danieljbruce
added a commit
that referenced
this pull request
Oct 20, 2026
…translate (#9642) ## Description Replaces proxyquire with sinon and direct stubs across four packages. ## Impact Removes --proxyquire-shim from gax, googleapis-common, error-reporting, and translate unit tests. ## Changes - **Part 1 of 5 in stacked PR series**: **#9642** -> #9643 -> #9644 -> #9645 -> #9646 (b/570680750). - `core/packages/gax`: Replace `proxyquire` in `test/unit/grpc.ts` with `sinon.stub(fs, 'existsSync')` and remove `--proxyquire-shim` from `package.json`. - `core/packages/nodejs-googleapis-common`: Replace `proxyquire` in `test/test.authplus.ts` and `test/test.http2.ts` with `sinon.stub(auth.GoogleAuth.prototype, 'getClient')` and `sinon.stub(coreHttp2, 'connect')`, and remove `--proxyquire-shim` from `package.json`. - `handwritten/error-reporting`: Stub `util.makeAuthenticatedRequestFactory` and `RequestHandler.prototype.request` directly in `test/unit/google-apis/auth-client.ts` and remove `--proxyquire-shim` from `package.json`. - `packages/google-cloud-translate`: Intercept `Module.prototype.require` directly in `test/index.ts` `before()` hook and remove `--proxyquire-shim` from `package.json`. ## Testing - Executed `pnpm test` under both Node.js and Bun (`JS_RUNTIME=bun`) in `core/packages/gax`, `core/packages/nodejs-googleapis-common`, `handwritten/error-reporting`, and `packages/google-cloud-translate`. - Verified strict lint and type checks pass via `bin/linter.mjs --strict`. ## Alternatives - Not merging this pull request was considered, which would leave these four packages dependent on the global `bin/proxyquire-bun-shim.cjs` preload shim.
danieljbruce
force-pushed
the
fix/remove-proxyquire-shim-core-dns-ds-bq
branch
from
October 20, 2026 14:27
05e25a8 to
d2820c8
Compare
This branch has not been deployed
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.
Description
Centralizes the runtime-agnostic
proxyquirehelper incore/test-utils(google-test-utils, Path 1B) and replaces the global--proxyquire-shimincore/common,handwritten/bigquery,handwritten/datastore, andhandwritten/google-cloud-dns.Impact
Removes
--proxyquire-shimfromcommon,bigquery,datastore, andgoogle-cloud-dnstest scripts while eliminating per-packagetest/proxyquire.tsduplication by exportingproxyquireandcreateProxyquirefromgoogle-test-utils.Changes
core/test-utils: Add runtime-agnosticsrc/proxyquire.tshelper (proxyquire,createProxyquire,Proxyquire,ProxyquireStubs) built onModule.prototype.requireandrequire.cachewith automatic caller path resolution (Error.prepareStackTrace) and unit tests intest/proxyquire.test.ts.core/common,handwritten/bigquery,handwritten/datastore,handwritten/google-cloud-dns: Import{proxyquire}from'google-test-utils', remove per-packagetest/proxyquire.tsshims, and remove--proxyquire-shimfrompackage.jsontest scripts.Testing
pnpm testincore/test-utilsand under both Node.js and Bun (JS_RUNTIME=bun) incore/common,handwritten/bigquery,handwritten/datastore, andhandwritten/google-cloud-dns.bin/linter.mjs --strict.Alternatives
test/proxyquire.tsfiles (Path 1A) were replaced with a single centralized implementation incore/test-utils(google-test-utils, Path 1B) per review discussion in b/570091189.