Featurevisor

Use cases

Test feature flags before deployment

A configuration change can alter application behaviour without changing application code. Keep its tests next to its definitions and run them before publishing datafiles.

Validate definitions and evaluate outcomes

From an installed Featurevisor project:

npx featurevisor lint
npx featurevisor test
npx featurevisor build

Lint checks schemas and references. Test specifications check evaluation results. The build produces the datafiles your applications will consume. Test failures produce a failing exit code that CI can use to stop publication.

Cover the default and an override

The remote configuration guide defines a paymentMethods variable with a Netherlands override. Its test file can check both paths:

tests/variables/paymentMethods.spec.yml
variable: paymentMethods
assertions:
- description: Netherlands uses the override
environment: production
context:
country: nl
expectedValue: [ideal, creditCard]
- description: Other users receive the default
environment: production
context:
country: gb
expectedValue: [creditCard, paypal]

Include relevant Target assertions when applications consume filtered datafiles.

Test the decisions that matter

Use the testing reference to cover features, segments, and global variables. Check rollout boundaries with at, required features that are enabled and disabled, variation dependent values, and nested override paths.

Global variables are not bucketed themselves. Their assertion's at value affects feature dependencies. Use matrices to avoid repeating similar assertions across several contexts.

Definition tests do not prove that application rendering, authorization, or fetching works. Keep integration tests in your application as well.

Place checks before publication

In your existing CI job, after installing the project's locked dependencies:

- name: Validate and test configuration
run: |
npx featurevisor lint
npx featurevisor test
npx featurevisor build

Publish only after this step succeeds, using your normal approval policy. Keep build state handling consistent with the state files guide.

The GitHub Actions guide and Cloudflare publishing example show the surrounding workflow. Use SDK examples to verify that your application's language SDK consumes the generated datafile as intended.

Previous
Environment variables
Next
v3