Skip to content

test(js): fix async assertions and force exit on test completion#5613

Draft
pavelgj wants to merge 1 commit into
mainfrom
pj/fix-test-speed-1
Draft

test(js): fix async assertions and force exit on test completion#5613
pavelgj wants to merge 1 commit into
mainfrom
pj/fix-test-speed-1

Conversation

@pavelgj

@pavelgj pavelgj commented Jun 24, 2026

Copy link
Copy Markdown
Member

Add missing await to assert.rejects calls in google-cloud metrics tests to ensure rejections are properly verified. Add --test-force-exit flag to ai and vercel-ai test scripts to prevent hanging processes after tests complete.

Add missing `await` to `assert.rejects` calls in google-cloud metrics
tests to ensure rejections are properly verified. Add `--test-force-exit`
flag to ai and vercel-ai test scripts to prevent hanging processes after
tests complete.

@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 adds the --test-force-exit flag to test scripts in js/ai/package.json and js/plugins/vercel-ai/package.json, and fixes several unawaited assert.rejects calls in js/plugins/google-cloud/tests/metrics_test.ts. The reviewer noted that the --test-force-exit flag was introduced in Node.js v22.10.0 and will cause test failures on older supported Node.js versions (such as Node.js 20). It is recommended to resolve the underlying resource leaks instead of forcing the process to exit.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread js/ai/package.json
"build": "npm-run-all build:clean check compile",
"build:watch": "tsup-node --watch",
"test": "node --import tsx --test ./tests/**/*_test.ts ./tests/*_test.ts",
"test": "node --import tsx --test --test-force-exit ./tests/**/*_test.ts ./tests/*_test.ts",

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.

high

The --test-force-exit flag was introduced in Node.js v22.10.0. Since this repository supports Node.js >=20, running tests on Node.js 20 or older Node.js 22 versions will fail with a bad option: --test-force-exit error. It is highly recommended to resolve the underlying resource leaks (such as unclosed servers, active timers, or open handles) instead of forcing the process to exit, to ensure compatibility across all supported Node.js versions.

"build": "npm-run-all build:clean check compile",
"build:watch": "tsup-node --watch",
"test": "tsx --test ./tests/*_test.ts"
"test": "tsx --test --test-force-exit ./tests/*_test.ts"

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.

high

The --test-force-exit flag was introduced in Node.js v22.10.0. Since this package specifies "engines": { "node": ">=20" }, running tests on Node.js 20 or older Node.js 22 versions will fail with a bad option: --test-force-exit error. Consider identifying and cleaning up the active handles (such as unclosed servers or active timers) causing the tests to hang, rather than using this flag.

@pavelgj pavelgj changed the title test: fix async assertions and force exit on test completion test(js): fix async assertions and force exit on test completion Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant