Skip to content

Commit eb9aea9

Browse files
malstounRyanZim
authored andcommitted
Shallow copy options object (#218)
* Shallow copy options object * Add test for glob patterns
1 parent d71fda9 commit eb9aea9

File tree

5 files changed

+42
-1
lines changed

5 files changed

+42
-1
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function css(css, file) {
180180
return rc(ctx, argv.config)
181181
.then(config => {
182182
config = config || cliConfig
183-
const options = config.options
183+
const options = Object.assign({}, config.options)
184184

185185
if (file === 'stdin' && output) file = output
186186

test/fixtures/glob/a.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.a {
2+
color: red;
3+
}

test/fixtures/glob/b.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.b {
2+
color: blue;
3+
}

test/fixtures/glob/s.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.a {
2+
color: red
3+
}

test/glob.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import test from 'ava'
2+
import path from 'path'
3+
4+
import cli from './helpers/cli.js'
5+
import tmp from './helpers/tmp.js'
6+
import read from './helpers/read.js'
7+
8+
test('works with glob patterns', async t => {
9+
const output = tmp()
10+
11+
const { error, stderr } = await cli([
12+
'test/fixtures/glob/*.css',
13+
'-d',
14+
output,
15+
'--no-map'
16+
])
17+
18+
t.ifError(error, stderr)
19+
20+
t.is(
21+
await read(path.join(output, 'a.css')),
22+
await read('test/fixtures/glob/a.css')
23+
)
24+
t.is(
25+
await read(path.join(output, 'b.css')),
26+
await read('test/fixtures/glob/b.css')
27+
)
28+
t.is(
29+
await read(path.join(output, 's.css')),
30+
await read('test/fixtures/glob/s.css')
31+
)
32+
})

0 commit comments

Comments
 (0)