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

Ensure adding additional trees does not affect include/exclude results. #147

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Funnel extends Plugin {
}
}

let inputPathExists = this.input.existsSync(this.srcDir || './');
let inputPathExists = this.input.at(0).fs.existsSync(this.srcDir || './');

let linkedRoots = false;
if (this.shouldLinkRoots()) {
Expand Down Expand Up @@ -317,9 +317,9 @@ class Funnel extends Plugin {
} else {

if (this._matchedWalk) {
entries = this.input.entries(this.srcDir || './', { globs: this.include, ignore: this.exclude });
entries = this.input.at(0).entries(this.srcDir || './', { globs: this.include, ignore: this.exclude });
} else {
entries = this.input.entries(this.srcDir || './');
entries = this.input.at(0).entries(this.srcDir || './');
}

entries = this._processEntries(entries);
Expand Down
34 changes: 34 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1167,5 +1167,39 @@ describe('broccoli-funnel', function() {

expect(walkSync(outputPath)).to.eql(['lol/', 'lol/foo.js']);
});

it('providing additional trees does not change matched files', async function() {
class FunnelSubclass extends Funnel.Funnel {
constructor(inputNode, options) {
super([inputNode, input.path('dir1/subdir1/subsubdir2')], options);

this._hasBuilt = false;
}

build() {
if (this._hasBuilt === false) {
if (!fs.existsSync(`${this.inputPaths[1]}/some.js`)) {
throw new Error('Could not find file!!!');
}
// set custom destDir to ensure our custom build code ran
this.destDir = 'lol';
this._hasBuilt = true;
}

return super.build();
}
}

let inputPath = input.path('lib/utils');
let node = new FunnelSubclass(inputPath, {
include: ['**/*.js'],
});
output = createBuilder(node);

await output.build();
let outputPath = output.path();

expect(walkSync(outputPath)).to.eql(['lol/', 'lol/foo.js']);
});
});
});