Skip to content

Commit

Permalink
add failing test for glob patterns and --parents option
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumevincent committed Dec 13, 2015
1 parent 96196ed commit fad2b31
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@ describe('cli', function () {
});
});

it('should keep path structure with flag "--parents" and glob patterns', function (done) {
fs.mkdirSync('tmp');
fs.mkdirSync('tmp/src');
fs.mkdirSync('tmp/src/subfolder');
fs.mkdirSync('tmp/dest');
fs.writeFileSync('tmp/src/hello.js', 'console.log("hello");');
fs.writeFileSync('tmp/src/subfolder/sf.js', 'console.log("sub folder");');
fs.writeFileSync('tmp/src/hello.txt', 'hello');

var sut = spawn('./cli.js', ['tmp/src/**/*.js', 'tmp/dest', '--parents']);
sut.on('close', function (status) {
assert.ok(status === 0, 'unexpected exit status: ' + status);
assert.strictEqual(
fs.readFileSync('tmp/dest/hello.js', 'utf8'),
fs.readFileSync('tmp/dest/subfolder/sf.js', 'utf8')
);
assert.ok(!fs.existsSync('tmp/dest/hello.txt'));
done();
});
});

it('should respect cwd', function (done) {
fs.mkdirSync('tmp');
fs.mkdirSync('tmp/cwd');
Expand Down

0 comments on commit fad2b31

Please sign in to comment.