-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
I looked up "nested tests" and found this issue but that discussion was going a different direction from what I was thinking.
I'm working on a CLI tool project and I want to convert my test from that shells script to Node.js, preferably with Ava. However, some things need to happen in a certain order.
Here's how far I've gotten:
import test from 'ava'
import shell from 'shelljs'
import exists from 'doug/utils/exists'
shell.config.fatal = true
test.before('doug-app init', (t) => {
// initialize doug-app
shell.cd('~')
shell.exec('doug-app init doug-app-test')
t.truthy(exists('doug-app-test'))
// link doug-app
shell.cd('cd ~/doug-app-test')
shell.exec('npm link doug-app')
// setup local git origin
shell.mkdir('doug-app-origin')
shell.cd('doug-app-origin')
shell.exec('git init --bare')
// push initial commit
shell.cd('~/doug-app-test')
shell.exec([
'git init',
'git add .',
'git config --global user.email "test@test.com"',
'git config --global user.name "Doug Test"',
'git commit -m "doug-app-test"',
'git remote add origin ~/doug-app-origin',
'git push origin master',
].join('; '))
})
test.test('doug-app test', (t) => {
shell.cd('cd ~/doug-app-test')
shell.exec('doug-app test')
})
test.test('doug-app build', (t) => {
shell.cd('cd ~/doug-app-test')
shell.exec('doug-app build')
t.truthy(exists('dist'))
})
test.test('doug-app deploy', (t) => {
shell.cd('cd ~/doug-app-test')
shell.exec('doug-app deploy')
shell.cd('~/doug-app-origin')
t.truthy(shell.exec('git branch | grep gh_pages').stdout.trim())
})
The thing is, deploy
need to happen after build
. But it is a different test, and can in parallel with other commands such as test
...
Metadata
Metadata
Assignees
Labels
No labels