Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/integration/cli-returns-help.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import test from 'ava'
import packageJson from '../../package.json'
import { gatsby } from '../support'

test('cli can be called and exits with 0', async t => {
Expand All @@ -17,3 +18,15 @@ test('cli returns help when called with unknown args', async t => {
const help = await gatsby(['--help'])
t.is(asdf.stdout, help.stdout)
})

test('cli does not return help when called with --version', async t => {
const version = await gatsby(['--version'])
const help = await gatsby(['--help'])
t.not(version.stdout, help.stdout)
})

test('cli returns the gatsby version when called with --version', async t => {
const versionCli = await gatsby(['--version'])
const versionPackage = packageJson.version
t.true(versionCli.stdout.indexOf(versionPackage) > -1)
})
4 changes: 2 additions & 2 deletions test/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export function spawn (command, args = [], options = {}) {
}

export function gatsby (args = [], options = {}) {
const spawnArguments = concat([gatsbyCli], args)
const spawnArguments = concat(['--', gatsbyCli], args)
return spawn(babel, spawnArguments, options)
}

export function build (fixturePath) {
const buildPath = path.resolve(fixturePath, 'public')
return remove(buildPath)
.then(() => spawn(babel, [gatsbyCli, 'build'], { cwd: fixturePath }))
.then(() => gatsby(['build'], { cwd: fixturePath }))
}

export function dom (filePath) {
Expand Down