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
Fix usage of allowEmpty
when also using include / exclude
#106
Conversation
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.
We need a test like
broccoli-funnel/tests/index.js
Lines 471 to 494 in bfea8d4
it('does not error with input node at a missing nested source', function() { | |
let inputPath = `${FIXTURE_INPUT}/dir1`; | |
let node = new Funnel(inputPath, { | |
srcDir: 'subdir3', | |
allowEmpty: true, | |
}); | |
let expected = []; | |
builder = new broccoli.Builder(node); | |
return builder.build() | |
.then(results => { | |
let outputPath = results.directory; | |
expect(walkSync(outputPath)).to.eql(expected); | |
}) | |
.then(() => builder.build()) | |
.then(results => { | |
let outputPath = results.directory; | |
expect(walkSync(outputPath)).to.eql(expected); | |
}); | |
}); | |
}); |
allowEmpty
is true, and input path doesn't exist). That test will likely answer your question RE: what to do in the fallback else
case.
Avoid trolling anything downstream which may *expect* a folder to be present, i.e. which does not understand or respect `allowEmpty` itself.
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.
Sorry for the run around, could you also create a test like:
it('creates nested output path when input node at a missing nested source', function() {
let inputPath = `${FIXTURE_INPUT}/dir1`;
let node = new Funnel(inputPath, {
include: ['*'],
srcDir: 'subdir3',
destDir: 'some-place',
allowEmpty: true,
});
let expected = ['some-place/'];
builder = new broccoli.Builder(node);
return builder.build()
.then(results => {
let outputPath = results.directory;
expect(walkSync(outputPath)).to.eql(expected);
})
.then(() => builder.build())
.then(results => {
let outputPath = results.directory;
expect(walkSync(outputPath)).to.eql(expected);
return builder.build();
})
.then(results => {
let outputPath = results.directory;
expect(walkSync(outputPath)).to.eql(expected);
});
});
Added that test also, @rwjblue. |
Ping @rwjblue – AppVeyor failure is unrelated. |
include
or exclude
are set.allowEmpty
when also using include / exclude
allowEmpty
when also using include / excludeallowEmpty
when also using include / exclude
Released in v2.0.2. |
Note that this implementation is a bit of a mess at this point. I'm happy to try to do some follow-on refactoring, but this solves the actual bug noted in #105 and identified while trying to fix adopted-ember-addons/ember-cli-sass#204.
Fixes #105.