Skip to content
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

Don't execute before/after on experiments that lack tests #584

Merged
merged 5 commits into from May 18, 2016

Conversation

@geek
Copy link
Member

geek commented May 17, 2016

Closes #337
Closes #440

@geek geek added the feature label May 17, 2016
@geek geek added this to the 10.5.2 milestone May 17, 2016
@geek geek assigned geek and cjihrig and unassigned geek May 17, 2016
@@ -256,7 +256,7 @@ internals.executeExperiments = function (experiments, state, skip, callback) {
const previousDomains = state.domains;
state.domains = [];

const skipExperiment = skip || experiment.options.skip;
const skipExperiment = skip || experiment.options.skip || !internals.experirementHasTests(experiment, state);

This comment has been minimized.

Copy link
@cjihrig

cjihrig May 17, 2016

Contributor

experiment is spelt wrong.

This comment has been minimized.

Copy link
@geek

geek May 18, 2016

Author Member

exper ire ment :(

}
});

return tests.length;

This comment has been minimized.

Copy link
@cjihrig

cjihrig May 18, 2016

Contributor

You should probably convert this to a Boolean before returning. "has tests" implies to me that it would be a Boolean.

geek added 2 commits May 18, 2016
@geek geek changed the title Don't execute before/after on expirements that lack tests Don't execute before/after on experiments that lack tests May 18, 2016
@@ -461,6 +461,36 @@ internals.executeTests = function (experiment, state, skip, callback) {
};


internals.experimentHasTests = function (experiment, state) {

if (experiment.experiments.length) {

This comment has been minimized.

Copy link
@AdriVanHoudt

AdriVanHoudt May 18, 2016

Contributor

purely personal opinion but I find > 0 more clear as to what you are doing, just a fyi

@@ -461,6 +461,36 @@ internals.executeTests = function (experiment, state, skip, callback) {
};


internals.experimentHasTests = function (experiment, state) {

This comment has been minimized.

Copy link
@Marsup

Marsup May 18, 2016

Member

Shall use .some() instead of filters in this, there's no need to have a full count, just need at least one.

This comment has been minimized.

Copy link
@geek

geek May 18, 2016

Author Member

good call

@cjihrig cjihrig merged commit 6de0f1b into hapijs:master May 18, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.