Turn experiments object into a function#7961
Merged
rwjblue merged 1 commit intoember-cli:masterfrom Aug 7, 2018
dcyriller:experiments-func
Merged
Turn experiments object into a function#7961rwjblue merged 1 commit intoember-cli:masterfrom dcyriller:experiments-func
rwjblue merged 1 commit intoember-cli:masterfrom
dcyriller:experiments-func
Conversation
Contributor
Author
|
A use of this PR would be here ember-cli/ember-cli-blueprint-test-helpers#153 |
Member
|
I am not opposed to changing this, but I would prefer a slightly different API. Seems like we can make this work: const { isExperimentEnabled } = require('./lib/experiments');
if (isExperimentEnabled('MODULE_UNIFICATION')) {
}What do you think? |
Contributor
Author
|
It sounds more consistent indeed. I just updated the PR. |
twokul
reviewed
Aug 6, 2018
Contributor
twokul
left a comment
There was a problem hiding this comment.
apart from failing tests, lgtm
kellyselden
approved these changes
Aug 6, 2018
Contributor
Author
|
I manually relaunched the tests. One test suite is still failing, it's the one that generates coverage. But it's also failing on master. |
When testing an experiment in `ember-cli` scope, a new CI scenario seems
to be the go-to solution. This involves scopping tests like this:
```js
if (experiments.MY_EXPERIMENT) {
describe('my experiment module', ...)
// or
module('my experiment module', ...)
} else {
describe('regular module', ...)
// or
module('regular module', ...)
}
```
But when testing an experiment outside of `ember-cli` scope, things get
different. And we may want to be able to do:
```js
describe('my addon blueprint', {
it('works - in a classic app', ...);
it('works - in a MU app', ...);
})
```
The issue is: as an object, `experiments` is cached between the two
tests (run on the same process). In these scenarios, we need not to
cache the object, hence the function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When testing an experiment in
ember-cliscope, a new CI scenario is the go-to solution. This involves scopping tests like this:But when testing an experiment outside of
ember-cliscope, things get different. And we may want to be able to test in sequence:The issue is: as an object, experiments is cached between the two tests (run on the same process). In these scenarios, we need not to cache the object, hence the function.