This method of stubbing in Jest specs will not automatically un-stub itself at the end of the test. We merge our stubbed experiment in with all the other global data in `window.gl`. If you need to remove the stubbed experiment(s) after your test or ensure a clean global object before your test, you'll need to manage the global object directly yourself:
```javascript
desribe('tests that care about global state',()=>{
constoriginalObjects=[];
beforeEach(()=>{
// For backwards compatibility for now, we're using both window.gon & window.gl
@@ -12,16 +13,26 @@ export function withGonExperiment(experimentKey, value = true) {
...
@@ -12,16 +13,26 @@ export function withGonExperiment(experimentKey, value = true) {
window.gon=origGon;
window.gon=origGon;
});
});
}
}
// This helper is for specs that use `gitlab-experiment` utilities, which have a different schema that gets pushed via Gon compared to `Experimentation Module`