Skip to content

Commit 07db678

Browse files
committed
add extra tests for .jshintignore
1 parent f8b57aa commit 07db678

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

.jshintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
test/fixtures/dontlint.txt
1+
test/fixtures/dontlint.txt
2+
node_modules/**

Gruntfile.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,16 @@ module.exports = function(grunt) {
3636
'test/fixtures/wrule.js'
3737
],
3838
},
39-
ignoresSupport: {
40-
src: ['test/fixtures/dontlint.txt'],
39+
ignoresSupportGruntFile: {
40+
src: ['test/fixtures/dontlint_gruntfile.txt'],
41+
options: {
42+
ignores: 'test/fixtures/dontlint_gruntfile.txt'
43+
}
44+
},
45+
// this rule should ignore node_modules and dontlint.txt using .jshintignore.
46+
// only nodemodule.js should be linted
47+
ignoresSupportIgnoreFile: {
48+
src: ['test/fixtures/dontlint.txt', 'node_modules/**', 'test/fixtures/nodemodule.js']
4149
},
4250
options: {
4351
jshintrc: '.jshintrc',

tasks/lib/jshint.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ exports.init = function(grunt) {
152152
delete options.extract;
153153
}
154154
var reporterOutputDir;
155-
156155
// Get reporter output directory for relative paths in reporters
157156
if (options.hasOwnProperty('reporterOutput')) {
158157
reporterOutputDir = path.dirname(options.reporterOutput);
File renamed without changes.

test/jshint_test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ exports.jshint = {
116116
test.done();
117117
});
118118
},
119+
jshintignoreInGruntfile: function(test) {
120+
test.expect(1);
121+
var files = [path.join(fixtures, 'dontlint_gruntfile.txt')];
122+
var options = {
123+
ignores: 'test/fixtures/dontlint_gruntfile.txt'
124+
};
125+
jshint.lint(files, options, function(results, data) {
126+
test.equal(data.length, 0, 'Should not have linted a file listed in the Gruntfile ignores setting');
127+
test.done();
128+
});
129+
},
119130
jshintignore: function(test) {
120131
test.expect(1);
121132
var files = [path.join(fixtures, 'dontlint.txt')];

0 commit comments

Comments
 (0)