You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use a simple `Record<string, boolean>` and pass it either in the constructor or by setting `client.flagOverrides`:
568
+
You can use a simple `Record<string, boolean>` and pass it either in the constructor or by replacing the client's base overrides with `setFlagOverrides()`:
For nested or temporary test overrides, use `pushFlagOverrides()`. It layers on top of the current overrides and returns a restore function that removes only that layer. You can wrap that in a small helper:
580
+
`pushFlagOverrides()` serves a different purpose: it adds a temporary layer on top of the base overrides and returns a restore function that removes only that layer. This is useful for nested tests:
581
581
582
582
```typescript
583
583
exportconst flag =function (name:string, enabled:boolean):void {
@@ -606,6 +606,13 @@ describe("foo", () => {
606
606
});
607
607
```
608
608
609
+
The precedence is:
610
+
611
+
1. Base overrides from the constructor or `setFlagOverrides()`
612
+
2. Temporary layers added by `pushFlagOverrides()`
613
+
614
+
If the same flag is set in both places, the pushed override wins until its restore function is called.
615
+
609
616
To get dynamic overrides, use a function which takes a context and returns a boolean or an object with the shape of `{isEnabled, config}`:
0 commit comments