Skip to content

Commit 0fae796

Browse files
committed
Should not allow writing multiple input files when writing to stdout
1 parent 42f8912 commit 0fae796

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Promise.resolve()
112112
error('You must pass a valid list of files to parse')
113113
}
114114

115-
if (i.length > 1 && output) {
115+
if (i.length > 1 && !argv.dir && !argv.replace) {
116116
error('Must use --dir or --replace with multiple input files')
117117
}
118118

test/error.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ test('multiple input files && --output', (t) => {
1616
})
1717
})
1818

19+
test('multiple input files && writing to stdout', (t) => {
20+
return cli(['test/fixtures/*.css'])
21+
.then(({ err, code }) => {
22+
t.is(code, 1, 'expected non-zero error code')
23+
t.regex(err, /Must use --dir or --replace/)
24+
})
25+
})
26+
1927
test('invalid --config', (t) => {
2028
return cli(
2129
[

0 commit comments

Comments
 (0)