-
Notifications
You must be signed in to change notification settings - Fork 316
fix(test): Docker skip guards + flaky test stabilization (#677) #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /** | ||
| * Shared test helpers for skip guards and environment detection. | ||
| * | ||
| * Provides reusable functions for detecting Docker availability, | ||
| * shell module availability, and other environment conditions | ||
| * that determine whether certain test suites should run. | ||
| */ | ||
|
|
||
| import { execSync } from 'node:child_process'; | ||
|
|
||
| /** | ||
| * Check if Docker is available on this machine. | ||
| * Returns true if `docker --version` succeeds within 5 seconds. | ||
| */ | ||
| export function isDockerAvailable(): boolean { | ||
| try { | ||
| execSync('docker --version', { stdio: 'ignore', timeout: 5000 }); | ||
| return true; | ||
| } catch { | ||
| return false; | ||
| } | ||
|
Comment on lines
+11
to
+21
|
||
| } | ||
|
|
||
| /** | ||
| * Determine skip reason for Docker-dependent tests. | ||
| * Returns null if tests should run, or a string reason to skip. | ||
| */ | ||
| export function dockerSkipReason(): string | null { | ||
| if (process.env['SKIP_DOCKER_TESTS'] === '1') { | ||
| return 'SKIP_DOCKER_TESTS=1'; | ||
| } | ||
| if (!isDockerAvailable()) { | ||
| return 'Docker not available'; | ||
| } | ||
| return null; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File header comment says this helper provides detection for "shell module availability" and "other environment conditions", but the file currently only implements Docker helpers. Either implement the additional guards or trim the comment to match the actual exports to avoid misleading future contributors.