forked from postcss/postcss-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace.js
More file actions
32 lines (24 loc) · 759 Bytes
/
replace.js
File metadata and controls
32 lines (24 loc) · 759 Bytes
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
import test from 'ava'
import fs from 'node:fs/promises'
import path from 'path'
import cli from './helpers/cli.js'
import tmp from './helpers/tmp.js'
import read from './helpers/read.js'
test('--replace works', async (t) => {
const dir = tmp()
const output = path.join(dir, 'output.css')
await fs.mkdir(dir, { recursive: true })
await Promise.all([
fs.copyFile('test/fixtures/import.css', output),
fs.copyFile('test/fixtures/a.css', path.join(dir, 'a.css')),
])
const { error, stderr } = await cli([
output.replace(/\\/g, '/'), // gotta keep globby happy on Windows
'--replace',
'-u',
'postcss-import',
'--no-map',
])
t.falsy(error, stderr)
t.is(await read(output), await read('test/fixtures/a.css'))
})