Skip to content

chore: remove proxyquire-bun-shim.cjs and runner flags - #9646

Draft
danieljbruce wants to merge 3 commits into
fix/remove-proxyquire-shim-bigtable-spanner-storagefrom
fix/remove-proxyquire-bun-shim
Draft

danieljbruce wants to merge 3 commits into
fix/remove-proxyquire-shim-bigtable-spanner-storagefrom
fix/remove-proxyquire-bun-shim

Conversation

@danieljbruce

@danieljbruce danieljbruce commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Removes bin/proxyquire-bun-shim.cjs and all remaining Mocha and runner shim configuration.

Impact

Eliminates the global Bun proxyquire preload shim from the test runner.

Changes

Testing

  • Verified unit tests across all migrated packages pass under both Node.js and Bun (JS_RUNTIME=bun) without bin/proxyquire-bun-shim.cjs.
  • Verified strict lint and type checks pass via bin/linter.mjs --strict.

Alternatives

  • Not merging this pull request was considered, which would leave dead shim code and unused --proxyquire-shim runner flags in the repository.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the Bun compatibility shim for proxyquire (proxyquire-bun-shim.cjs) and cleans up all associated configuration, flags, and preloading logic across the test runner (bin/run-test.cjs) and various package .mocharc.js files. I have no feedback to provide as there are no review comments and the changes are straightforward cleanups.

@danieljbruce
danieljbruce added this pull request to stack #9647 October 15, 2026 21:18

@danieljbruce danieljbruce left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Just an isolated removal of the Shim. All the other PRs can remove unnecessary references to the shim on top of this. I probably would have removed the references first, but it likely doesn't matter too much as long as we follow through with removing everything.

@danieljbruce

Copy link
Copy Markdown
Contributor Author

This LGTM. Just an isolated removal of the Shim. All the other PRs can remove unnecessary references to the shim on top of this. I probably would have removed the references first, but it likely doesn't matter too much as long as we follow through with removing everything.

Nevermind. This PR actually is meant to be reviewed/merged last so this comment doesn't apply. LGTM then.

@danieljbruce

danieljbruce commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

My main concern with this PR stack is that it is creating exact local replicas of the proxyquire patch in different locations. I think it could be a better option to replace proxyquire with sinon completely.

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
danieljbruce force-pushed the fix/remove-proxyquire-bun-shim branch from 937810c to e404d9a Compare October 20, 2026 14:27

This branch has not been deployed

No deployments
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