Controlling Parallelism
See original GitHub issueI 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
…
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Parallelism | GD&T Basics
Axis Parallelism is a tolerance that controls how parallel a specific parts central axis needs to be to a datum plane or axis....
Read more >Parallelism Control - an overview | ScienceDirect Topics
Control parallelism (e.g. doall loops) can be defined as structures (e.g. arrays) of tasks. Single tasks are Java threads and parallelism can be...
Read more >Controlling Parallelism (GNU Findutils 4.9.0)
This is called "serial" execution; the commands happen in a series, one after another. If you'd like xargs to do things in "parallel",...
Read more >Parallelism of a Surface - Engineering Essentials
Parallelism Control : Perfect parallelism occurs when a surface is exactly parallel to a datum. Parallelism is an orientation control. The parallelism control...
Read more >Task parallelism - Wikipedia
Task parallelism (also known as function parallelism and control parallelism) is a form of parallelization of computer code across multiple processors in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yup. Or perhaps do all that setup in a
test.before()
and assign a promise for each stage to a variable. Then in your tests you could writeconst result = await buildStage
and then do the assertions.I like that a lot actually. Thanks @novemberborn!