Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
  • Loading branch information
rostik404 committed Dec 14, 2016
1 parent 90fdb11 commit e392147
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
3 changes: 1 addition & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ const expandPath = (path, options) => {

return utils.isFile(path)
.then((isFile) => isFile ? [path] : listFiles(path))
.then((paths) => paths.filter((path) => utils.matchesFormats(path, options.formats)))
.then((paths) => options.root ? paths.map((path) => qfs.absolute(path)) : paths);
.then((paths) => paths.filter((path) => utils.matchesFormats(path, options.formats)));
};

const processPaths = (paths, cb) => {
Expand Down
31 changes: 0 additions & 31 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ describe('path-utils', () => {
assert.deepEqual(paths, ['some/path/file.js']);
});
});

it('should get absolute file path from passed mask if project root is specified', () => {
glob.withArgs('some/path/*.*').yields(null, ['some/path/file.js']);

qfs.absolute.withArgs('root/some/path/file.js').returns('/absolute/root/some/path/file.js');

return globExtra.expandPaths(['some/path/*.*'], {root: 'root'})
.then((paths) => assert.deepEqual(paths, ['/absolute/root/some/path/file.js']));
});
});

describe('directories', () => {
Expand Down Expand Up @@ -133,17 +124,6 @@ describe('path-utils', () => {
assert.deepEqual(paths, ['some/path/file.js']);
});
});

it('should get absolute file path from passed dir if project root is specified', () => {
glob.withArgs('some/path/').yields(null, ['some/path/file.js']);

qfs.absolute.withArgs('root/some/path/file.js').returns('/absolute/root/some/path/file.js');

return globExtra.expandPaths(['some/path/'], {root: 'root'})
.then((paths) => {
assert.deepEqual(paths, ['/absolute/root/some/path/file.js']);
});
});
});

describe('files', () => {
Expand Down Expand Up @@ -188,17 +168,6 @@ describe('path-utils', () => {
assert.deepEqual(paths, ['some/path/file.js']);
});
});

it('should return absolute file path from passed file path if project root is specified', () => {
glob.withArgs('some/path/file.js').yields(null, ['some/path/file.js']);

qfs.absolute.withArgs('root/some/path/file.js').returns('/absolute/root/some/path/file.js');

return globExtra.expandPaths(['some/path/file.js'], {root: 'root'})
.then((paths) => {
assert.deepEqual(paths, ['/absolute/root/some/path/file.js']);
});
});
});

describe('defaults', () => {
Expand Down

0 comments on commit e392147

Please sign in to comment.