Skip to content

Commit

Permalink
test for exiting watch process with EOF / Ctrl-D
Browse files Browse the repository at this point in the history
  • Loading branch information
tverlaan committed Nov 12, 2020
1 parent d79bb8d commit 8f98838
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/watch.js
Expand Up @@ -3,7 +3,7 @@ const test = require('ava')

const fs = require('fs-extra')
const path = require('path')
const { exec } = require('child_process')
const { exec, spawn } = require('child_process')
const chokidar = require('chokidar')

const ENV = require('./helpers/env.js')
Expand Down Expand Up @@ -285,3 +285,14 @@ testCb("--watch doesn't exit on CssSyntaxError", (t) => {
// Timeout:
setTimeout(() => t.end('test timeout'), 50000)
})

testCb('--watch does exit on closing stdin (Ctrl-D/EOF)', (t) => {
t.plan(0)

const cp = spawn(
`node ${path.resolve('bin/postcss')} -o output.css -w --no-map`,
{ shell: true }
)
cp.on('exit', () => t.end())
cp.stdin.end()
})

0 comments on commit 8f98838

Please sign in to comment.