Skip to content

Commit

Permalink
Improve Result API
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Aug 18, 2020
1 parent a04e8c5 commit 9931511
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -125,9 +125,9 @@ const result = observable.waitForEnd()
assert.equal(result, {
exitCode: 0,
killed: false,
stdOutput: "... content from STDOUT ...",
errOutput: "... content from STDERR ...",
combinedOutput: "... content from both STDOUT and STDERR ...",
stdText: "... content from STDOUT ...",
errText: "... content from STDERR ...",
combinedText: "... content from both STDOUT and STDERR ...",
})
```

Expand Down
6 changes: 3 additions & 3 deletions test/kill-test.ts
Expand Up @@ -23,9 +23,9 @@ test("ObservableProcess.kill()", async function () {
await assertIsNotRunning(port)
assert.equal(result.killed, true, "process should be killed")
assert.equal(result.exitCode, -1)
assert.equal(result.stdOutput, "online\n")
assert.equal(result.errOutput, "")
assert.equal(result.combinedOutput, "online\n")
assert.equal(result.stdText, "online\n")
assert.equal(result.errText, "")
assert.equal(result.combinedText, "online\n")
})

async function assertIsRunning(port: number) {
Expand Down
12 changes: 6 additions & 6 deletions test/wait-for-end-test.ts
Expand Up @@ -11,17 +11,17 @@ test("process ends before calling it", async function () {
const result = await observable.waitForEnd()
assert.deepEqual(result.exitCode, 7)
assert.deepEqual(result.killed, false)
assert.deepEqual(result.stdOutput, "hello\n")
assert.deepEqual(result.errOutput, "")
assert.deepEqual(result.combinedOutput, "hello\n")
assert.deepEqual(result.stdText, "hello\n")
assert.deepEqual(result.errText, "")
assert.deepEqual(result.combinedText, "hello\n")
})

test("process still running when calling it", async function () {
const observable = start(["node", "-e", "setTimeout(function() { console.log('finally'); process.exit(8)}, 10)"])
const result = await observable.waitForEnd()
assert.equal(result.exitCode, 8)
assert.equal(result.killed, false)
assert.equal(result.stdOutput, "finally\n")
assert.equal(result.errOutput, "")
assert.equal(result.combinedOutput, "finally\n")
assert.equal(result.stdText, "finally\n")
assert.equal(result.errText, "")
assert.equal(result.combinedText, "finally\n")
})

0 comments on commit 9931511

Please sign in to comment.