-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
957da98
commit 8b6a150
Showing
7 changed files
with
3,425 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require('../src/cli')() |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import test from 'ava' | ||
import { promisify } from 'util' | ||
import childProcess from 'child_process' | ||
import path from 'path' | ||
|
||
const execFile = promisify(childProcess.execFile) | ||
const tested = path.join(__dirname, 'cli.js') | ||
|
||
test('output help without command', async (t) => { | ||
const { code, stdout, stderr } = await t.throws(execFile(tested)) | ||
t.true(code === 1) | ||
t.true(stdout === '') | ||
t.true(stderr.startsWith('ybiquitous <command>')) | ||
t.true(stderr.includes('init Initialize Node.js project')) | ||
}) | ||
|
||
test('output help with `--help` option', async (t) => { | ||
const { stdout, stderr } = await execFile(tested, ['--help']) | ||
t.true(stdout.startsWith('ybiquitous <command>')) | ||
t.true(stderr === '') | ||
}) |
Oops, something went wrong.