Skip to content

test: remove --proxyquire-shim from bigtable, spanner, and storage - #9641

Closed
danieljbruce wants to merge 4 commits into
googleapis:mainfrom
danieljbruce:fix/remove-proxyquire-shim-bigtable-spanner-storage
Closed

danieljbruce wants to merge 4 commits into
googleapis:mainfrom
danieljbruce:fix/remove-proxyquire-shim-bigtable-spanner-storage

Conversation

@danieljbruce

@danieljbruce danieljbruce commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Replaces global proxyquire shim with local test helper in three packages.

Impact

Removes --proxyquire-shim from bigtable, spanner, and storage unit test scripts.

Changes

Testing

  • Executed pnpm test under both Node.js and Bun (JS_RUNTIME=bun) in handwritten/bigtable, handwritten/spanner, and handwritten/storage.
  • Verified strict lint and type checks pass via bin/linter.mjs --strict.

Alternatives

  • Not merging this pull request was considered, which would leave Bigtable, Spanner, and Storage dependent on the global bin/proxyquire-bun-shim.cjs preload shim.

@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 --proxyquire-shim flag from test scripts across multiple packages, introducing a local proxyquire utility and updating test imports, while replacing it with sinon stubs or custom module loader overrides in other areas. The feedback suggests refactoring several tests in bigtable, pubsub, and spanner to use async/await and assert.rejects instead of silencing linter rules with eslint-disable-next-line for unhandled promises or missing returns, which will prevent potential silent test failures and improve code quality.

Comment on lines +1219 to 1220
// eslint-disable-next-line promise/catch-or-return, promise/always-return
bigtable.close().then(() => {

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.

medium

Silencing the linter with eslint-disable-next-line for unhandled promises can lead to silent test failures or hangs if bigtable.close() rejects, as the done callback would never be called. Instead of disabling the linter, consider refactoring the test to use async/await and removing the done callback entirely.

Comment on lines +394 to 395
// eslint-disable-next-line promise/always-return
void queue.publishDrain().then(() => {

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.

medium

Instead of disabling the promise/always-return linter rule, consider refactoring the test to use async/await. This avoids callback nesting, simplifies the asynchronous flow, and eliminates the need for linter overrides.

Comment on lines +430 to 431
// eslint-disable-next-line promise/always-return
void queue.publish('test').then(() => {

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.

medium

Instead of disabling the promise/always-return linter rule, consider refactoring the test to use async/await to simplify the asynchronous flow and avoid linter overrides.

Comment on lines +332 to 333
// eslint-disable-next-line promise/always-return
.then(() => {

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.

medium

Instead of disabling the promise/always-return linter rule, consider refactoring the test to use async/await with assert.rejects. This is much cleaner, avoids callback-based assertions, and eliminates the need for linter overrides.

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