mercredi 22 avril 2015

How to test child processes using chai and mocha

I'm creating a framework to execute processes at a specific time (cron-like) and to tests, I'm using chai-mocha-grunt to test.

The architecture of solution is based on this example. Basically, we have:

  • A Master file, which calls the Child (via child_process.fork) a specific number of times.
  • A Child file, which execute something using setInverval();
  • A file to call Master.start() function and starts the process.

With this architecture, How to test if threads are executed in correct time using mocha and chai (with 'assert' library)?

In other words, how to make chai 'listen' the threads and check if them are executed in correct time?

Thanks for patience and attention!

Best regards,

Giovane

Aucun commentaire:

Enregistrer un commentaire