-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Re-enable feature flags #3979
Re-enable feature flags #3979
Conversation
This add the `babel-plugin-feature-flag` BabelJS plugin to the build pipeline, so all code paths are stripped for features, which are not enabled in `config/features.json`. Feature detection within the addon is handled similar to the one in Ember.js: ``` import isEnabled from 'ember-data/features'; if (isEnabled("ds-new-feature")) { // code for the feature } ```
Nice work here @pangratz! |
Optional features and the corresponding tests can now be enabled within the tests by specifying the `test-optional-features` environment: ember test --environment=test-optional-features
Optional feature flags can now be enabled via a checkbox, rendered at the top of the test page. The state of the checkbox is set as query parameter in the URL. An in-repo-addon ensures that the ENABLE_OPTIONAL_FEATURES flag works correctly, when the tests are run inside a browser: the workaround using the in-repo-addon is needed, since the flag needs to be set before Ember.js is loaded, but there is currently no other way.
|
||
return array.join('\n'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwjblue do you, as an ember-cli resident, have an idea for a nicer solution than this? Basically EmberENV
needs to be modified after QUnit
is loaded (so we have access to QUnit.urlconfig
and before ember
is loaded (so the updated, latest version of EmberENV
is considered).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is javascript we should probably use JS comments instead of HTML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is javascript we should probably use JS comments instead of HTML
👍 absolutely
👍 You are my hero @pangratz \o/ |
This re-enables testing feature flags and stripping disabled feature flags from production build (using ember-cli/babel-plugin-feature-flags).
Feature flags are now possible within ember-data by using the following setup:
The features need to be defined within
config/features.json
. Disabled feature flags are also stripped from production builds.Running the tests with all optional feature flags enabled is possible via
ember test --environment=test-optional-features
. When the tests are run viaember serve
, the optional feature flags can be enabled via a checkbox.This addresses #3922.