-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathmap.js
55 lines (43 loc) · 1.12 KB
/
map.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import test from 'ava'
import fs from 'fs-extra'
import cli from './helpers/cli.js'
import tmp from './helpers/tmp.js'
import read from './helpers/read.js'
test('inline maps are generated by default', async (t) => {
const output = tmp('output.css')
const { error, stderr } = await cli([
'test/fixtures/import.css',
'-u',
'postcss-import',
'-o',
output,
])
t.falsy(error, stderr)
t.regex(await read(output), /\/*# sourceMappingURL=/)
})
test('--map generates external sourcemaps', async (t) => {
const output = tmp('output.css')
const { error, stderr } = await cli([
'test/fixtures/import.css',
'-u',
'postcss-import',
'-o',
output,
'--map',
])
t.falsy(error, stderr)
t.truthy(await fs.pathExists(output.replace('.css', '.css.map')))
})
test('--no-map disables internal sourcemaps', async (t) => {
const output = tmp('output.css')
const { error, stderr } = await cli([
'test/fixtures/import.css',
'-u',
'postcss-import',
'-o',
output,
'--no-map',
])
t.falsy(error, stderr)
t.notRegex(await read(output), /\/*# sourceMappingURL=/)
})