question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Controlling Parallelism

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
novemberborncommented, Dec 19, 2016

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 write const result = await buildStage and then do the assertions.

0reactions
ccorcoscommented, Dec 19, 2016

I like that a lot actually. Thanks @novemberborn!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found