Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kevgo committed Jul 18, 2019
1 parent 6273d14 commit 213e70f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/observable.ts
Expand Up @@ -24,7 +24,9 @@ export function spawn(args: SpawnOptions) {
} else if (args.commands != null) {
argv = args.commands
} else {
throw new Error("you must provide either command or commands")
throw new Error(
"observable.spawn: you must provide either command or commands"
)
}
const [runnable, ...params] = argv

Expand Down
10 changes: 9 additions & 1 deletion test/start-test.ts
@@ -1,5 +1,5 @@
import * as observable from "../src/observable"
import { strict as assert } from "assert"
import * as observable from "../src/observable"

describe(".spawn()", function() {
it("starts a process via an argv array", async function() {
Expand All @@ -25,6 +25,14 @@ describe(".spawn()", function() {
await process.waitForEnd()
assert.equal(process.exitCode, 0)
})

it("throws if it receives neither a string nor argv array", function() {
assert.throws(function() {
observable.spawn({})
}, new Error(
"observable.spawn: you must provide either command or commands"
))
})
})

describe("environment variables", function() {
Expand Down

0 comments on commit 213e70f

Please sign in to comment.