Skip to content

Commit

Permalink
Merge branch 'develop' into feature/fix-variable-for-property
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPurdy committed Jun 7, 2016
2 parents 3426200 + 66ab2d5 commit 557c625
Show file tree
Hide file tree
Showing 32 changed files with 1,646 additions and 1,366 deletions.
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,31 +190,29 @@ sassLint.lintFiles = function (files, options, configPath) {
ignores = this.getConfig(options, configPath).files.ignore || '';
if (files.indexOf(', ') !== -1) {
files.split(', ').forEach(function (pattern) {
includes = includes.concat(glob.sync(pattern, {ignore: ignores}));
includes = includes.concat(glob.sync(pattern, {ignore: ignores, nodir: true}));
});
}
else {
includes = glob.sync(files, {ignore: ignores});
includes = glob.sync(files, {ignore: ignores, nodir: true});
}
}
// If not passed in then we look in the config file
else {
files = this.getConfig(options, configPath).files;
// A glob pattern of files can be just a string
if (typeof files === 'string') {
includes = glob.sync(files);
includes = glob.sync(files, {nodir: true});
}
// Look into the include property of files and check if there's an array of files
else if (files.include && files.include instanceof Array) {
files.include.forEach(function (pattern) {
includes = includes.concat(glob.sync(pattern, {ignore: files.ignore}));
includes = includes.concat(glob.sync(pattern, {ignore: files.ignore, nodir: true}));
});
}
// Or there is only one pattern in the include property of files
else {
includes = glob.sync(files.include, {
'ignore': files.ignore
});
includes = glob.sync(files.include, {ignore: files.ignore, nodir: true});
}
}

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"preversion": "npm test",
"pretest": "eslint .",
"test": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec -t 3000 tests tests/rules",
"test": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec -t 3000 tests tests/rules tests/helpers",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"bin": {
Expand Down Expand Up @@ -45,6 +45,7 @@
"coveralls": "^2.11.4",
"deep-equal": "^1.0.1",
"istanbul": "^0.4.0",
"mocha": "^2.2.5"
"mocha": "^2.2.5",
"sinon": "^1.17.4"
}
}
18 changes: 18 additions & 0 deletions tests/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ describe('cli', function () {
});
});

it('should not try to read and lint a directory', function (done) {
var command = 'sass-lint "tests/dir-test/**/*.scss" --no-exit --verbose --format json';

exec(command, function (err, stdout) {
var result = JSON.parse(stdout);
if (err) {
return done(err);
}

assert(stdout.indexOf('.scss') !== -1);
assert(stdout.indexOf('.sass') === -1);
assert.equal(result.length, 1);
assert.equal(result[0].filePath, 'tests/dir-test/dir.scss/test.scss');

return done();
});
});

it('Should accept multiple input paths', function (done) {
var command = 'sass-lint "tests/cli/cli-error.scss, tests/cli/cli-error.sass" --no-exit --verbose';

Expand Down
3 changes: 3 additions & 0 deletions tests/dir-test/dir.scss/test.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#foo {
content: '';
}
Loading

0 comments on commit 557c625

Please sign in to comment.