Skip to content

feat(generator): use runtime-agnostic test runner in GAPIC package templates - #9394

Merged
quirogas merged 2 commits into
bun-runtime/1-test-runnerfrom
bun-runtime/2-generator-template
Sep 22, 2026
Merged

quirogas merged 2 commits into
bun-runtime/1-test-runnerfrom
bun-runtime/2-generator-template

Conversation

@quirogas

@quirogas quirogas commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Currently, the GAPIC TypeScript generator templates hardcode c8 mocha build/test as the "test" script in every generated package.json. Whenever libraries are generated or regenerated, their test scripts default back to c8, which forces #!/usr/bin/env node and prevents tests from running on the Bun runtime.

This PR updates the CommonJS and ESM GAPIC package.json templates in core/generator/gapic-generator-typescript (along with the generator test baselines) to use node ../../bin/run-test.cjs build/test instead. When developers or CI run pnpm test on Node.js, bin/run-test.cjs continues to run c8 mocha with coverage as usual. When invoked with bun --bun run test, Bun intercepts the node call and executes bin/run-test.cjs directly inside the Bun runtime.

@quirogas
quirogas added this pull request to stack #9397 September 21, 2026 16:02

@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 updates the test and system-test scripts across various baseline and template package.json files to execute tests using a centralized runner script (node ../../bin/run-test.cjs) instead of invoking c8 mocha directly. There are no review comments, so I have no feedback to provide.

…mplates

Updates the CJS and ESM GAPIC package.json templates (and corresponding generator test baselines) to invoke node ../../bin/run-test.cjs --config ../../.mocharc.cjs instead of c8 mocha directly.

This ensures newly generated GAPIC client libraries run unit and system tests through bin/run-test.cjs across both Node.js and Bun runtimes.
@quirogas
quirogas force-pushed the bun-runtime/2-generator-template branch from c0013df to 49ceeae Compare September 22, 2026 04:26
@quirogas
quirogas marked this pull request as ready for review September 22, 2026 04:48
@quirogas
quirogas requested a review from a team as a code owner September 22, 2026 04:48
@github-actions
github-actions Bot requested a review from feywind September 22, 2026 04:48

@danieljbruce danieljbruce 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.

This looks fine for the sake of getting the bun testing changes in, but we really should try to understand the full impact of removing c8 and we should try to understand the reason it was there in the first place.

@quirogas
quirogas merged commit 4ca5d45 into main Sep 22, 2026
37 checks passed
@quirogas
quirogas deleted the bun-runtime/2-generator-template branch September 22, 2026 22:23
@quirogas

Copy link
Copy Markdown
Contributor Author

This looks fine for the sake of getting the bun testing changes in, but we really should try to understand the full impact of removing c8 and we should try to understand the reason it was there in the first place.

We use c8 for test coverage and should still aim to have test coverage; however, keeping it within our test execution causes issues when running on different runtimes. The solution is to remove C8 from individual per-package execution and implement a dedicated CI check for test coverage, allowing for a more runtime-agnostic test configuration.

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.

2 participants