-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
23 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { createObservableProcess, RunningProcess } from "../../src/observable-process" | ||
import { run, RunningProcess } from "../../src/observable-process" | ||
|
||
export function startNodeProcess(code: string): RunningProcess { | ||
return createObservableProcess(["node", "-e", code]) | ||
return run(["node", "-e", code]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { strict as assert } from "assert" | ||
import { createObservableProcess } from "../src/observable-process" | ||
import { run } from "../src/observable-process" | ||
import util from "util" | ||
const delay = util.promisify(setTimeout) | ||
|
||
suite("ObservableProcess.waitForEnd()") | ||
|
||
test("process ends before calling it", async function () { | ||
const observable = createObservableProcess(["node", "-e", "console.log('hello')"]) | ||
const observable = run(["node", "-e", "console.log('hello')"]) | ||
await delay(50) | ||
const result = await observable.waitForEnd() | ||
assert.equal(result.exitCode, 0) | ||
}) | ||
|
||
test("process still running when calling it", async function () { | ||
const observable = createObservableProcess(["node", "-e", "setTimeout(function() {}, 10)"]) | ||
const observable = run(["node", "-e", "setTimeout(function() {}, 10)"]) | ||
const result = await observable.waitForEnd() | ||
assert.equal(result.exitCode, 0) | ||
}) |