docs: document feature flags (#13388)

This commit is contained in:
Shahed Nasser
2025-09-02 12:26:54 +03:00
committed by GitHub
parent bd206cb250
commit e96c0e4d09
9 changed files with 727 additions and 67 deletions

View File

@@ -631,4 +631,27 @@ const response = await api.post(`/custom`, form, {
...authHeaders,
},
})
```
```
---
## Write Tests for Feature-Flagged API Routes
If your API route is hidden behind a [feature flag], you can use the `env` option of `medusaIntegrationTestRunner` its feature flag.
For example:
```ts title="integration-tests/http/custom-routes.spec.ts"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
medusaIntegrationTestRunner({
env: {
FF_BLOG_FEATURE: true,
},
testSuite: ({ api, getContainer }) => {
// TODO write tests...
},
})
```
The `env` option accepts an object of environment variables to set for the test suite.