The test suite for my Lua project is split up into multiple files inside the spec/
directory.
Is there a way to ask busted to run those tests in parallel? If I call busted
without any arguments it runs all the tests sequentially.

- 68,213
- 24
- 160
- 246
2 Answers
One thing that seems to work is to use GNU Parallel to run multiple test scripts at once.
parallel busted -o utfTerminal ::: spec/*_spec.lua
The -o utfTerminal
is to tell busted to use the familiar "green circles" output instead of the simplified text output it uses when its stdout is redirected.

- 68,213
- 24
- 160
- 246
I don't understand much about the Busted library, but apparently what you want is working with multiple threads
Threads are basically the process where the code executes line by line until the end. When we create more threads for a code, multiple loops, functions, etc ... within this new Thread, they executed simultaneously with the original code, without interfering in the process, that is, more than one thing is executed in parallel.
Unfortunately Lua does not contain a way to perform multiple threads, the most it has to work with threads is coroutines. However, there are libraries like lua-llthreads that perform this task, try it out and see what you think. By joining it with your code with Busted, you will be able to perform parallel tasks

- 606
- 1
- 4
- 18
-
I imagine it would be easier to run it as separate processes instead of threads. However, I don't know how to do that without messing up the stdout, with every process talking at the same time. – hugomg Aug 20 '20 at 23:33
-
@hugomg you can try to create a new Lua script and run each one separately in different scripts with `os.execute()` for example: you separate each of them into `script1.lua`, `script2.lua` and `script3.lua`, then you create a so-called `execute.lua` and do: `os.execute("lua script1.lua")` `os.execute("lua script2.lua")` `os.execute("lua script3.lua")` you can also use `io.popen()` but it usually serves to collect some return from cmd. – Vinni Marcon Aug 21 '20 at 04:52
-
@hugomg I managed to solve your problem and/or clarify your question? – Vinni Marcon Aug 21 '20 at 17:58