Skip to content

Fix WithTestRegistry so that feature flags apply to the callback #10757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks
techanvil opened this issue May 13, 2025 · 1 comment
Open
2 tasks

Fix WithTestRegistry so that feature flags apply to the callback #10757

techanvil opened this issue May 13, 2025 · 1 comment
Labels
P2 Low priority Type: Infrastructure Engineering infrastructure & tooling

Comments

@techanvil
Copy link
Collaborator

techanvil commented May 13, 2025

Feature Description

As discussed here, using WithTestRegistry while providing a callback alongside a set of features can lead to unexpected results, because the features won't be enabled until after the callback has executed.

This is illustrated with a contrived story in PR #10758, but as can be seen from the comment linked above it's something we've run into during active development.

We should ensure the features are enabled prior to the callback executing to reflect the real-world expectation of how features should be applied.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Use of WithTestRegistry should be updated so that enabled features apply when executing the callback.

Implementation Brief

  • Remove the features prop from WithTestRegistry and instead import enabledFeatures from tests/js/utils.js.
  • Update all stories which pass the features prop to WithTestRegistry to intead provide them via {Story}.parameters.features, this will ensure enabledFeatures is updated via this default decorator in storybook/preview.js.

Test Coverage

  • Ensure all stories are unchanged.
  • No new tests needed.

QA Brief

Changelog entry

@techanvil techanvil self-assigned this May 13, 2025
@techanvil techanvil added P2 Low priority Type: Infrastructure Engineering infrastructure & tooling labels May 13, 2025
@techanvil techanvil removed their assignment May 13, 2025
@nfmohit nfmohit self-assigned this May 15, 2025
@nfmohit
Copy link
Collaborator

nfmohit commented May 17, 2025

IB ✅

@nfmohit nfmohit removed their assignment May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Low priority Type: Infrastructure Engineering infrastructure & tooling
Projects
None yet
Development

No branches or pull requests

2 participants