wait command is designed for CI/CD pipelines and container orchestration (like Kubernetes). It blocks the execution of a follow-up command until all defined Preflight probes pass.
Usage
Options
| Option | Description | Default |
|---|---|---|
-s, --schema <path> | Path to the schema file | .preflight.yaml |
-e, --env <name> | Environment to validate | default |
-t, --timeout <ms> | Maximum time to wait before failing | 60000 (60s) |
-i, --interval <ms> | How often to poll the infrastructure | 2000 (2s) |
-q, --quiet | Suppress polling status messages | - |
Example: Database Gating
Ensure your database and cache are ready before starting your application:- Scan your schema for connectivity probes (
postgres,redis, etc.). - Poll those services every 2 seconds.
- If all pass, it will spawn
npm start. - If it fails to connect within 60 seconds, it will exit with code
1and block the app from starting.
Example: CI Integration
Usewait in your CI test step to ensure the test database is fully booted before running tests: