Skip to content

Commit

Permalink
Error handling in cli system test (#2115)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkabardin committed Nov 29, 2016
1 parent 2c2327b commit b05bef1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion system-tests/004/004.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,29 @@ import { spawn } from "child_process"
it("004", (done) => {
const localPath = path.resolve(__dirname)
const cliPath = path.join(localPath, "../../src/cli.js")
const cliProcess = spawn("babel-node", [ cliPath, `${localPath}/*.css` ])
const cliProcess = spawn(
"babel-node",
[ cliPath, `${localPath}/*.css` ],
{
cwd: localPath,
detached: false,
shell: true,
})

cliProcess.on("close", function (code) {
expect(code).not.toEqual(0)
done()
})

cliProcess.on("error", (err) => {
console.log("[systemTest004] cli fail:", err) // eslint-disable-line no-console
})

cliProcess.stdout.on("data", (data) => {
console.log("[systemTest004] cli stdout:", data) // eslint-disable-line no-console
})

cliProcess.stderr.on("data", (data) => {
console.log("[systemTest004] stderr:", data) // eslint-disable-line no-console
})
})

0 comments on commit b05bef1

Please sign in to comment.