Skip to content

Commit

Permalink
'path-utils' → 'glob-extra'
Browse files Browse the repository at this point in the history
  • Loading branch information
rostik404 authored and eGavr committed Aug 22, 2016
1 parent 8576b06 commit e36c644
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 141 deletions.
38 changes: 0 additions & 38 deletions lib/path-utils.js

This file was deleted.

8 changes: 5 additions & 3 deletions lib/tests-reader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';

var pathUtils = require('./path-utils'),
var globExtra = require('glob-extra'),
_ = require('lodash'),
q = require('q'),
validateUnknownBrowsers = require('./validators').validateUnknownBrowsers;

const expandJsPaths = (paths) => globExtra.expandPaths(paths, {formats: ['.js']});

module.exports = function(testPaths, browsers, config) {
var specs = config.specs,
configBrowsers = _.keys(config.browsers),
Expand All @@ -14,7 +16,7 @@ module.exports = function(testPaths, browsers, config) {

return q.all([
expandSpecs(specs, configBrowsers),
pathUtils.expandPaths(testPaths)
expandJsPaths(testPaths)
])
.spread(function(specs, testFiles) {
return filterSpecs(specs, testFiles, browsers);
Expand All @@ -35,7 +37,7 @@ function expandSpecs(specs, configBrowsers) {

var paths = _.isString(spec) ? [spec] : spec.files;

return pathUtils.expandPaths(paths)
return expandJsPaths(paths)
.then(function(files) {
return {
files: files,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@
"chalk": "^1.1.1",
"clear-require": "^1.0.1",
"commander": "^2.9.0",
"glob": "^7.0.5",
"glob-extra": "^1.1.0",
"inherit": "^2.2.2",
"lodash": "~3.10.1",
"mocha": "~2.4.5",
"q": "^2.0.0",
"q-io": "^2.0.6",
"q-promise-utils": "^1.0.0",
"qemitter": "^1.1.0",
"teamcity-service-messages": "^0.1.6",
Expand Down
4 changes: 2 additions & 2 deletions test/lib/cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const q = require('q');
const pathUtils = require('../../lib/path-utils');
const globExtra = require('glob-extra');
const cli = require('../../lib/cli');
const logger = require('../../lib/utils').logger;
const ConfigReader = require('../../lib/config-reader');
Expand All @@ -12,7 +12,7 @@ describe('exit codes', () => {
const sandbox = sinon.sandbox.create();

beforeEach(() => {
sandbox.stub(pathUtils, 'expandPaths').returns(q([]));
sandbox.stub(globExtra, 'expandPaths').returns(q([]));
sandbox.stub(logger);
sandbox.stub(process, 'exit');
sandbox.stub(ConfigReader.prototype, 'read');
Expand Down
81 changes: 0 additions & 81 deletions test/lib/path-utils.js

This file was deleted.

30 changes: 15 additions & 15 deletions test/lib/tests-reader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var pathUtils = require('../../lib/path-utils'),
var globExtra = require('glob-extra'),
readTests = require('../../lib/tests-reader'),
logger = require('../../lib/utils').logger,
makeConfigStub = require('../utils').makeConfigStub,
Expand All @@ -11,10 +11,10 @@ describe('tests-reader', function() {
var sandbox = sinon.sandbox.create();

beforeEach(function() {
sandbox.stub(pathUtils, 'expandPaths');
sandbox.stub(globExtra, 'expandPaths');
sandbox.stub(logger, 'warn');

pathUtils.expandPaths.returns(q([]));
globExtra.expandPaths.returns(q([]));
});

afterEach(function() {
Expand All @@ -40,7 +40,7 @@ describe('tests-reader', function() {
});

it('should assign specified browsers to specified test files in specs', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test1']).returns(q(['/test1']))
.withArgs(['dir']).returns(q(['/dir/test2', '/dir/test3']));

Expand All @@ -61,7 +61,7 @@ describe('tests-reader', function() {
});

it('should support intersection of test paths in specs', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['dir', 'dir1']).returns(q(['/dir/test', '/dir1/test']))
.withArgs(['dir', 'dir2']).returns(q(['/dir/test', '/dir2/test']));

Expand All @@ -82,7 +82,7 @@ describe('tests-reader', function() {
});

it('should support intersection of subpaths in specs', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['dir']).returns(q(['/dir/sub-dir/test']))
.withArgs(['dir/sub-dir']).returns(q(['/dir/sub-dir/test']));

Expand All @@ -103,7 +103,7 @@ describe('tests-reader', function() {
});

it('should support intersection of browsers in specs', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test1']).returns(q(['/test1']))
.withArgs(['test2']).returns(q(['/test2']));

Expand All @@ -125,7 +125,7 @@ describe('tests-reader', function() {
});

it('should assign all browsers to test files which are specified as strings in specs', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test1']).returns(q(['/test1']))
.withArgs(['test2']).returns(q(['/test2']));

Expand All @@ -143,7 +143,7 @@ describe('tests-reader', function() {
});

it('should assign all browsers to test files which are specified as objects without `browsers` property', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test1']).returns(q(['/test1']))
.withArgs(['test2']).returns(q(['/test2']));

Expand All @@ -161,7 +161,7 @@ describe('tests-reader', function() {
});

it('should support string and object notations in specs', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test1']).returns(q(['/test1']))
.withArgs(['test2']).returns(q(['/test2']));

Expand All @@ -179,7 +179,7 @@ describe('tests-reader', function() {
});

it('should not assign unknown browsers to test files', function() {
pathUtils.expandPaths.withArgs(['test']).returns(q(['/test']));
globExtra.expandPaths.withArgs(['test']).returns(q(['/test']));

var params = {
config: {
Expand All @@ -206,7 +206,7 @@ describe('tests-reader', function() {
});

it('should filter browsers from specs in case of input browsers', function() {
pathUtils.expandPaths.withArgs(['test']).returns(q(['/test']));
globExtra.expandPaths.withArgs(['test']).returns(q(['/test']));

var params = {
config: {
Expand All @@ -220,7 +220,7 @@ describe('tests-reader', function() {
});

it('should not assign unknown input browsers to test files', function() {
pathUtils.expandPaths.withArgs(['test']).returns(q(['/test']));
globExtra.expandPaths.withArgs(['test']).returns(q(['/test']));

var params = {
config: {
Expand Down Expand Up @@ -248,7 +248,7 @@ describe('tests-reader', function() {
});

it('should filter test files from specs in case of input test paths', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test1']).returns(q(['/test1']))
.withArgs(['test2']).returns(q(['/test2']));

Expand All @@ -264,7 +264,7 @@ describe('tests-reader', function() {
});

it('should not assign browsers to unknown input test paths', function() {
pathUtils.expandPaths
globExtra.expandPaths
.withArgs(['test']).returns(q(['/test']))
.withArgs(['unknown-test']).returns(q(['/unknown-test']));

Expand Down

0 comments on commit e36c644

Please sign in to comment.