Mock Feature Flag Config Generator
Generates realistic fake feature flag configuration objects for testing feature toggle systems
About this generator
Feature flag systems — LaunchDarkly, Unleash, Flagsmith, and homegrown toggles — evaluate configs with flag keys, enabled states, rollout percentages, and per-environment overrides. Testing the logic that reads those configs requires fixture data with real variation: some flags at 0% in production, others at 100% in staging, a few partial canaries. This generator produces realistic flag configs with all those fields. Set count (2–25) to match your scenario. Choose format: JSON for API mocking and Jest fixtures, YAML for Kubernetes ConfigMaps and Helm values, or ENV for serverless deployments. JSON output includes feature_flags array with key, enabled, rollout_percentage, description, environment overrides, and created_at. For edge-case coverage, look for rollout_percentage values between 1 and 99 — partial rollouts are where most evaluation bugs hide.
How to use
- Set the Number of Flags input to match how many flag objects your test scenario or UI requires.
- Select your Output Format — JSON for API mocking, YAML for Kubernetes configs, or ENV for serverless deployments.
- Click Generate to produce a complete, randomized feature flag configuration object.
- Copy the output and paste it into your fixture file, seed script, or test setup block.
- Regenerate as many times as needed to get different rollout percentages and flag states for broader test coverage.
Use Cases
- •Seeding a feature flag admin dashboard with 8+ realistic sample flags for UI development
- •Generating JSON fixture files for Jest unit tests covering partial rollout edge cases
- •Mocking LaunchDarkly or Unleash configs inside Cypress integration test suites
- •Populating a local Flagsmith or Flipt instance with varied flag states during dev setup
- •Creating YAML fixtures for Kubernetes feature flag ConfigMap and Helm chart testing
Tips
- →Generate the same flag count twice and diff the outputs to build test cases that verify your system handles config changes correctly.
- →For ENV format output, pipe it directly into a `.env.test` file — most test runners load this automatically without extra setup.
- →When testing partial rollout logic, look for flags with 1-99% rollout values in the output; these are the edge cases most evaluation bugs hide in.
- →Combine JSON output with a schema validator like Ajv or Zod in your test suite to confirm your flag parser handles every generated shape without errors.
- →Generate 20+ flags when building a flag management UI — you need enough data to trigger pagination, overflow states, and search filtering realistically.
- →For LaunchDarkly SDK mock testing, use the JSON output as the response body in an MSW or nock interceptor to simulate the flag evaluation API.
FAQ
how do I generate mock feature flag configs for unit tests in javascript
Set the flag count to match your test scenario, pick JSON, and click Generate. Paste the output directly into a Jest fixture file or your test setup block. For table-driven tests, generate a larger batch and slice out the enabled, disabled, and partial-rollout states you need.
can I use generated flag configs to mock LaunchDarkly or Unleash in integration tests
Yes. The JSON output includes flag key, enabled state, rollout percentage, and per-environment overrides — the core fields both platforms evaluate. You may need to rename a field or two to match your SDK's exact schema, but the structure transfers with minimal adjustment.
are rollout percentages in the output random or do they follow a pattern
Percentages are randomized independently per flag. When a flag is enabled (about 60% of generated flags), rollout_percentage is a random integer from 0 to 100. When a flag is disabled, rollout_percentage is set to 0. This gives you a realistic mix of 0%, 100%, and intermediate values.
what fields does each generated feature flag object include
Each JSON flag object includes: key (snake_case combining a prefix like enable_ with a feature name), enabled (boolean), rollout_percentage (integer 0–100), description, an environments object with production/staging/development boolean overrides, and created_at (a date string). YAML and ENV formats include a subset of these fields.
You might also like
Popular tools from other categories that share themes with this one.