-
Notifications
You must be signed in to change notification settings - Fork 222
fix(test): shared Docker skip guard + template-sync timeout (#677) #679
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
base: dev
Are you sure you want to change the base?
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
+12
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.
The file header comment claims this helper also covers “shell module availability” and other conditions, but this module currently only implements Docker helpers. This makes the comment misleading—either remove that claim or add the corresponding helper(s).