Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 7406e79

Browse files
committed
Fix --watch tests + move cssnext bin (.js enable lint) (1.0.1)
1 parent 4e36e86 commit 7406e79

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.1 - 2015-02-18
2+
3+
- Fixed: cssnext binary doesn't exit on an error if --watch is enabled ([#69](https://github.com/cssnext/cssnext/pull/69))
4+
15
# 1.0.0 - 2015-02-06
26

37
- Changed: upgraded to postcss v4.x
File renamed without changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cssnext",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Use tomorrow's CSS syntax, today",
55
"keywords": [
66
"css",
@@ -71,6 +71,6 @@
7171
"test": "tape test/*.js"
7272
},
7373
"bin": {
74-
"cssnext": "bin/cssnext"
74+
"cssnext": "bin/cssnext.js"
7575
}
7676
}

test/cli.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,22 @@ test("cli", function(t) {
111111
})
112112
planned+=2
113113

114-
var childProcess = exec(cssnextBin + " --watch test/fixtures/cli.error.css test/fixtures/cli.output--watch.css", function(err, stdout, stderr) {
115-
t.ok(utils.contains(stderr, "encounters an error"), "should output error messages when `--watch` option passed")
114+
var watchProcess = exec(cssnextBin + " --watch test/fixtures/cli.error.css test/fixtures/cli.output--watch.css", function(err) {
116115
t.ok(err && err.signal === "SIGTERM", "should only be killed by an interrupt when `--watch` option passed")
117116
if (err && !err.killed) { throw err }
118117
})
119-
setTimeout(function() { childProcess.kill("SIGTERM") }, 2000)
118+
var msgWatch = "should output error messages when `--watch` option passed"
119+
var watchTimeout = setTimeout(function() {
120+
t.fail(msgWatch)
121+
watchProcess.kill("SIGTERM")
122+
}, 5000)
123+
watchProcess.stderr.on("data", function(data) {
124+
if (utils.contains(data, "encounters an error")) {
125+
t.pass(msgWatch)
126+
clearTimeout(watchTimeout)
127+
watchProcess.kill("SIGTERM")
128+
}
129+
})
120130
planned+=2
121131

122132
t.plan(planned)

0 commit comments

Comments
 (0)