forked from postcss/postcss-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstdin.js
More file actions
28 lines (22 loc) · 663 Bytes
/
stdin.js
File metadata and controls
28 lines (22 loc) · 663 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
import test from 'ava'
import { createReadStream } from 'node:fs'
import path from 'path'
import { exec } from 'child_process'
import tmp from './helpers/tmp.js'
import read from './helpers/read.js'
test.cb('reads from stdin', (t) => {
const output = tmp('output.css')
const cp = exec(
`node ${path.resolve('index.js')} -o ${output} --no-map`,
(error, stdout, stderr) => {
if (error) t.end(error, stderr)
Promise.all([read(output), read('test/fixtures/a.css')])
.then(([a, e]) => {
t.is(a, e)
t.end()
})
.catch(t.end)
},
)
createReadStream('test/fixtures/a.css').pipe(cp.stdin)
})