Skip to content

Commit

Permalink
Add new failing test showing "working directory bleed through".
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed May 3, 2021
1 parent bfa5088 commit 72ac062
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require('mocha-eslint')([
});

const Funnel = require('..');
const ROOT = process.cwd();

describe('broccoli-funnel', function() {
let input, output, FIXTURE_INPUT;
Expand Down Expand Up @@ -49,6 +50,8 @@ describe('broccoli-funnel', function() {
});

afterEach(function() {
process.chdir(ROOT);

input.dispose();
output && output.dispose();
});
Expand Down Expand Up @@ -180,6 +183,24 @@ describe('broccoli-funnel', function() {
expect(assertions).to.equal(0, 'Build did not throw an error, relative path traversal worked.');
});

it("does not mistake a folder within working directory as the srcDir being present", async function() {
input.write({
someDir: {},
otherDir: {},
});
process.chdir(input.path());

let node = new Funnel(input.path("otherDir"), {
allowEmpty: true,
srcDir: "someDir",
destDir: "my-output",
});
output = createBuilder(node);
await output.build();

expect(walkSync(output.path())).to.eql(["my-output/"]);
});

it("missing srcDir with allowEmpty results in empty destDir", async function() {
let node = new Funnel(FIXTURE_INPUT, {
allowEmpty: true,
Expand Down

0 comments on commit 72ac062

Please sign in to comment.