Skip to content

Commit 4700e09

Browse files
authoredJun 9, 2020
Add --silently-ignore
Closes GH-24. Reviewed-by: Titus Wormer <tituswormer@gmail.com>
1 parent 0f12dcf commit 4700e09

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed
 

‎lib/options.js

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function options(flags, configuration) {
7979
ignorePath: config.ignorePath,
8080
ignorePathResolveFrom: config.ignorePathResolveFrom,
8181
ignorePatterns: commaSeparated(config.ignorePattern),
82+
silentlyIgnore: config.silentlyIgnore,
8283
detectIgnore: config.ignore,
8384
pluginPrefix: configuration.pluginPrefix,
8485
plugins: plugins(config.use),

‎lib/schema.json

+5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@
129129
"description": "output formatted syntax tree",
130130
"type": "boolean"
131131
},
132+
{
133+
"long": "silently-ignore",
134+
"description": "suppress warnings about given ignored files",
135+
"type": "boolean"
136+
},
132137
{
133138
"long": "stdout",
134139
"description": "specify writing to stdout",

‎test/fixtures/example/HELP

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Options:
2424
--tree-in specify input as syntax tree
2525
--tree-out output syntax tree
2626
--inspect output formatted syntax tree
27+
--silently-ignore suppress warnings about given ignored files
2728
--[no-]stdout specify writing to stdout (on by default)
2829
--[no-]color specify color in report (on by default)
2930
--[no-]config search for configuration files (on by default)

‎test/fixtures/example/LONG_FLAG

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Error: Unknown option `--no`, expected:
1919
--tree-in specify input as syntax tree
2020
--tree-out output syntax tree
2121
--inspect output formatted syntax tree
22+
--silently-ignore suppress warnings about given ignored files
2223
--[no-]stdout specify writing to stdout (on by default)
2324
--[no-]color specify color in report (on by default)
2425
--[no-]config search for configuration files (on by default)

‎test/index.js

+46
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,52 @@ test('unified-args', function (t) {
566566
}
567567
})
568568

569+
t.test('should fail when given an ignored path', function (t) {
570+
var expected = [
571+
'one.txt',
572+
' 1:1 error Cannot process specified file: it’s ignored',
573+
'',
574+
'two.txt: no issues found',
575+
'',
576+
figures.cross + ' 1 error'
577+
].join('\n')
578+
579+
t.plan(1)
580+
581+
execa(bin, ['one.txt', 'two.txt', '--ignore-pattern', 'one.txt']).then(
582+
t.fail,
583+
onfail
584+
)
585+
586+
function onfail(result) {
587+
t.deepEqual(
588+
[result.exitCode, strip(result.stderr)],
589+
[1, expected],
590+
'should fail'
591+
)
592+
}
593+
})
594+
595+
t.test('should support `--silently-ignore`', function (t) {
596+
t.plan(1)
597+
598+
execa(bin, [
599+
'one.txt',
600+
'two.txt',
601+
'--ignore-pattern',
602+
'one.txt',
603+
'--silently-ignore'
604+
]).then(onsuccess, t.fail)
605+
606+
function onsuccess(result) {
607+
t.deepEqual(
608+
[result.stdout, strip(result.stderr)],
609+
['', 'two.txt: no issues found'],
610+
'should work'
611+
)
612+
}
613+
})
614+
569615
t.test('should honour `--watch`', function (t) {
570616
var expected = [
571617
'Watching... (press CTRL+C to exit)',

0 commit comments

Comments
 (0)
Please sign in to comment.