forked from postcss/postcss-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.js
More file actions
60 lines (48 loc) · 1.18 KB
/
map.js
File metadata and controls
60 lines (48 loc) · 1.18 KB
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
56
57
58
59
60
import test from 'ava'
import fs from 'node:fs/promises'
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.access(output.replace('.css', '.css.map')).then(
() => true,
() => false,
),
)
})
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=/)
})