Skip to content

Commit

Permalink
Fix deny on cli
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 23, 2020
1 parent fa1f391 commit 74345ad
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function transform(options) {
]
}

plugins.push([filter, {allow: settings.allow}])
plugins.push([filter, {allow: settings.allow, deny: settings.deny}])

/* istanbul ignore if - hard to check. */
if (cli.flags.diff) {
Expand Down
26 changes: 26 additions & 0 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,32 @@ test('alex-cli', function (t) {
}
})

t.test('deny', function (t) {
var fp = path.join('test', 'fixtures', 'deny', 'two.md')

t.plan(1)

childProcess.exec('./cli.js ' + fp, onexec)

function onexec(err, stdout, stderr) {
t.deepEqual(
[err.code, stderr, stdout],
[
1,
[
fp,
' 1:5-1:11 warning Be careful with `beaver`, it’s profane in some cases beaver retext-profanities',
'',
'⚠ 1 warning',
''
].join('\n'),
''
],
'should work'
)
}
})

t.test('default globs', function (t) {
t.plan(1)

Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/deny/.alexrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deny": ["beaver"]
}
1 change: 1 addition & 0 deletions test/fixtures/deny/two.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The beaver has a large butt.

0 comments on commit 74345ad

Please sign in to comment.