node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


Jiny - runs tests/jobs in parallel

jiny allows to run your tests/jobs/commands in parallel on the different servers. Main goal of jiny is horizontal scalability for testing.

It has 4 main features:

  • upload project folder to the all servers (slaves) - jiny upload
  • prepare project on the all slaves - jiny run "./"
  • make job queue based on mask and pattern and run in parallel jiny feed *.js "mocha -R spec @"
  • make job queue based on pipe and run in parallel find ... | jiny jobs


  • Require: tar
  • npm install -g jiny




> jiny 
  Usage: jiny [options] [command]
       Starts master
       Starts slave
       Upload dir to the slaves
    run [command]
       Runs command on the all slaves. Prepare project on the all slaves. `jiny run "./"`
    feed [mask] [pattern]
       Find files by mask, build job based on pattern and runs jobs in parallel on different slaves. Replaces `@` -> `[file name]`. Example: `jiny --dir tests feed *.js "mocha -R spec @"`
       Runs commands in  in parallel on the different slaves. Uses pipe: `find tests/ | grep .js | awk '{print "echo "$1" && sleep 1"}' | jiny jobs`
       Stops slaves and master
    wait.slaves [quantity]
       Waits for slaves registered in the master
    -h, --help     output usage information
    -V, --version  output the version number
    --port [port]  master port
    --host [host]  master host
    --dir [dir]    work dir
    --detach       runs detached process: master / slave
    --live         master option to save alive slaves after exit
    --skip-upload  slave option to skip upload on this slave, if you want to use slave on the master

Local example

Make dirs

  • mkdir ~/my-project # make project dir
  • mkdir ~/my-project-1 # make slave dir 1
  • mkdir ~/my-project-2 # make slave dir 2

Start master and slaves (in different terminals)

  • jiny master --dir ~/my-project/ # start master
  • jiny slave --dir ~/my-project-1/ # start slave #1
  • jiny slave --dir ~/my-project-2/ # start slave #2

Prepare project (in another terminal)

> jiny run "echo prepare-project && pwd && sleep 1" # run same command on the both slaves in same time
I am client
#1 > echo prepare-project && pwd && sleep 1
#2 > echo prepare-project && pwd && sleep 1
PASSed 1s

Make fake tests

  • mkdir ~/my-project/tests # make like tests dir in the project
  • touch ~/my-project/tests/test1.js # make like test1
  • touch ~/my-project/tests/test2.js # make like test2

Upload tests to slaves

> jiny upload # upload project to slaves
I am client
#1 uploaded dir: /home/vagrant/my-project-1/ time: 0s
#2 uploaded dir: /home/vagrant/my-project-2/ time: 0s
done 0s
#### Check uploaded data
> jiny run "pwd && ls tests" # check that tests have been uploaded
I am client
#1 > pwd && ls tests
#2 > pwd && ls tests
PASSed 0s

Find files by mask, build job based on pattern and runs jobs in parallel

  • it will run commands one by one on the free slaves
  • slave #1 executes test1.js, slave #2 executest test2.js in same time.
  • in this example I use mocha to run these tests
  • real examples looks like:
    • jiny feed --dir features *.feature "cucumber.js features/@"
    • jiny feed --dir src *Test.php "phpunit -c app/ src/@"
> jiny --dir ~/my-project/tests feed *.js "mocha -R spec tests/@"
I am client
#1 > mocha -R spec tests/test1.js
  0 passing (5ms)
#2 > mocha -R spec tests/test2.js
  0 passing (5ms)
PASSed 0s

Stop all: slaves and master

> jiny stop # stops all, slaves and master


Start master and slaves (in same terminal)

  • if you want to work in one terminal use --detach option.
    • jiny master --dir ~/my-project/ --detach # start master
    • jiny slave --dir ~/my-project-1/ --detach # start slave #1
    • jiny slave --dir ~/my-project-2/ --detach # start slave #2

Find files by find and grep and pipe it to jiny jobs

  • if you want to make job queue by pipe you can use this example
> find ~/my-project/tests | grep .js | awk '{print "echo "$1" && sleep 1"}' | jiny jobs
I am client
#1 > echo /home/vagrant/my-project/tests/test1.js && sleep 1
#2 > echo /home/vagrant/my-project/tests/test2.js && sleep 1
PASSed 1s

Run your tests in parallel, be scalable horizontal! Enjoy and be happy!